From cabad31b5e7eab39845bbf618884cab616e1eabf Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 25 Apr 2026 05:32:54 +0100 Subject: [PATCH] Add Epiphany state update notification --- notes/epiphany-current-algorithmic-map.md | 39 +- notes/epiphany-fork-implementation-plan.md | 26 +- notes/fresh-workspace-handoff.md | 16 +- state/evidence.jsonl | 2 + state/map.yaml | 11 +- tools/epiphany_phase5_smoke.py | 55 ++ .../schema/json/ServerNotification.json | 35 + .../codex_app_server_protocol.schemas.json | 37 + .../codex_app_server_protocol.v2.schemas.json | 37 + ...hreadEpiphanyStateUpdatedNotification.json | 723 ++++++++++++++++++ .../schema/typescript/ServerNotification.ts | 3 +- .../ThreadEpiphanyStateUpdatedNotification.ts | 6 + .../schema/typescript/v2/index.ts | 1 + .../src/protocol/common.rs | 42 + .../app-server-protocol/src/protocol/v2.rs | 8 + vendor/codex/codex-rs/app-server/README.md | 1 + .../app-server/src/codex_message_processor.rs | 37 +- 17 files changed, 1039 insertions(+), 40 deletions(-) create mode 100644 vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadEpiphanyStateUpdatedNotification.json create mode 100644 vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyStateUpdatedNotification.ts diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index 1ea4534e..2c8cdc53 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -10,7 +10,7 @@ The important question for this file is not "what is Epiphany supposed to become Current Epiphany is a forked Codex harness with a typed modeling spine. -The spine exists in ten live paths: +The spine exists in eleven live paths: - protocol state shape: `EpiphanyThreadState`, `RolloutItem::EpiphanyState`, retrieval summaries, and prompt tags live in [protocol.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/protocol/src/protocol.rs:103). - in-memory session state: `SessionState` stores an optional `EpiphanyThreadState`, and `Session` exposes thin async accessors over it in [state/session.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/state/session.rs:36) and [session/mod.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/session/mod.rs:1240). @@ -21,6 +21,7 @@ The spine exists in ten live paths: - explicit map/churn proposals: app-server routes read-only `thread/epiphany/propose` through a loaded-thread handler into `epiphany-core` so verified observations with code refs and accepting recent evidence can be selected explicitly or auto-selected as a bounded path cluster, prioritize the strongest selected observation, focus or extend architecture graph nodes, rescue unanchored graph nodes through strict semantic overlap, carry linked dataflow nodes and incident graph edges into the frontier, update churn candidates with match-kind-aware map-delta judgment and pressure, and still avoid mutation until promotion in [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4244) and [proposal.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/proposal.rs:115). - explicit promotion gates: app-server routes `thread/epiphany/promote` through a loaded-thread handler into `epiphany-core` policy evaluation, rejects failed verifier evidence without mutation, applies accepted candidates through the same durable update path, and now treats medium/high/expanded/broadening/semantic churn deltas as needing explicit rationale plus stronger verifier evidence whose kind is token-matched rather than substring-matched in [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4316) and [promotion.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/promotion.rs:33). - explicit state updates: app-server routes `thread/epiphany/update` through a loaded `CodexThread` update method that mutates live `SessionState`, bumps the revision, and persists an immediate `RolloutItem::EpiphanyState` snapshot in [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4416) and [codex_thread.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/codex_thread.rs:373). +- live state notifications: app-server declares experimental `thread/epiphany/stateUpdated` and emits it with the updated typed state after successful direct updates and accepted promotions, but not after rejected promotions, in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:1097), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4059), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4417), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4494). - retrieval/indexing: app-server routes `thread/epiphany/retrieve` and `thread/epiphany/index` through loaded `CodexThread` host methods into `epiphany-core` in [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4046), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4122), [codex_thread.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/codex_thread.rs:438), and [codex_thread.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/codex_thread.rs:456). The thick Epiphany-owned implementation is mostly outside vendored Codex now: @@ -79,6 +80,8 @@ flowchart TD ZA --> ZB["Apply typed patch and increment revision"] ZB --> B ZB --> ZC["Persist immediate RolloutItem::EpiphanyState"] + ZB --> ZD["Emit thread/epiphany/stateUpdated notification"] + ZD --> Q ZC --> K T --> V["epiphany-core retrieve_workspace"] U --> W["epiphany-core index_workspace"] @@ -94,6 +97,7 @@ What this means in plain English: - A loaded thread can ask for a typed observation/evidence proposal without mutating state. - A loaded thread can ask a verifier-backed promotion gate to reject or apply that proposal. - A loaded thread can now accept explicit typed state patches and persist them immediately. +- Successful direct updates and accepted promotions now notify clients that typed state changed. - Retrieval and indexing are typed side paths hanging off loaded threads. - Retrieval remains read-only; state mutation has its own control-plane door. - Map/churn proposal is also read-only; accepted graph/churn edits still go through promotion and update. @@ -102,9 +106,9 @@ What this means in plain English: Source audit on 2026-04-25 re-read each flow below against the cited code instead of just checking that links resolve. -The current landed machine is still coherent. The core shape is not ornamental: one protocol state object flows through session state, prompt rendering, rollout persistence, thread hydration, explicit retrieval/indexing, read-only distillation/proposal, verifier-backed promotion, and the single durable update writer. The useful simplification pressure is already present in the boundaries: retrieval reads, indexing writes only the semantic catalog, distillation/proposal draft patches, promotion gates, and update persists. +The current landed machine is still coherent. The core shape is not ornamental: one protocol state object flows through session state, prompt rendering, rollout persistence, thread hydration, explicit retrieval/indexing, read-only distillation/proposal, verifier-backed promotion, the single durable update writer, and now a live state notification that reflects completed writes. The useful simplification pressure is already present in the boundaries: retrieval reads, indexing writes only the semantic catalog, distillation/proposal draft patches, promotion gates, update persists, and notification broadcasts only after the write is done. -Nothing in the current typed spine obviously deserves deletion right now. The parts that would turn this into Jenga are still correctly listed as non-flows: automatic tool-output ingestion, watcher invalidation, GUI reflection, specialist scheduling, and an automatic Compact-Rehydrate-Reorient-Continue coordinator. The next Perfect Machine move is therefore not adding another writer or a shiny surface. After match-kind-aware map-delta judgment, source-output-aware distillation, first risky-delta promotion policy, and a richer app-server smoke harness, the next pressure belongs in running that harness as a guardrail and adding only the smallest source-grounded policy/proposal rule real use exposes. +Nothing in the current typed spine obviously deserves deletion right now. The parts that would turn this into Jenga are still correctly listed as non-flows: automatic tool-output ingestion, watcher invalidation, GUI reflection, specialist scheduling, broad event streaming, and an automatic Compact-Rehydrate-Reorient-Continue coordinator. The next Perfect Machine move is therefore not adding another writer or a shiny surface. After match-kind-aware map-delta judgment, source-output-aware distillation, first risky-delta promotion policy, a richer app-server smoke harness, and the first state-update notification, the next pressure belongs in running that harness as a guardrail and adding only the smallest source-grounded notification/read/proposal/promotion rule real use exposes. ## Natural Language Spine @@ -125,6 +129,7 @@ This is the same flow in the language Epiphany is supposed to make the model car | Proposal | Verified observations with code refs and accepting recent evidence can produce a candidate graph frontier/churn patch without writing it. The caller can provide ids, or the proposal engine can choose a small ready path cluster, then reuse existing map nodes, focus linked context, and report pressure from the actual map delta. | The clerk overlays tracing paper on the old blueprint before drawing a new wall through the plumbing, choosing only the relevant marked pages before measuring how much load the sketch would put on the frame. | | Promotion | A verifier-backed gate can reject a proposal without mutation or send it through the durable update path. | The foreman stamps the pencil draft before the clerk reaches for the red pen. | | State updates | A loaded thread can accept explicit typed patches that append observations/evidence and replace bounded map/scratch/churn fields. | The clerk finally has the red pen, but still writes only on the ledger page the form allows. | +| State notifications | Successful direct updates and accepted promotions publish the updated typed state to app-server clients. | The clerk rings the little counter bell only after the ledger ink is dry, not when a draft gets rejected. | ## Flow 1: State Shape @@ -567,7 +572,8 @@ The app-server handler: 3. maps the app-server patch DTO into `EpiphanyStateUpdate`. 4. calls `CodexThread.epiphany_update_state`. 5. returns the updated `EpiphanyThreadState`. -6. reports empty patches and revision mismatches as invalid requests. +6. emits `thread/epiphany/stateUpdated` with the same updated state. +7. reports empty patches and revision mismatches as invalid requests before notification. `CodexThread.epiphany_update_state`: @@ -585,6 +591,7 @@ The replay helpers now also accept an out-of-band Epiphany snapshot before the f Code refs: - [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4416) +- [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4494) - [codex_thread.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/codex_thread.rs:100) - [codex_thread.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/codex_thread.rs:373) - [codex_thread.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/codex_thread.rs:543) @@ -593,11 +600,11 @@ Code refs: ### Output -The response contains the updated `epiphanyState`. The durable side effect is a rollout `EpiphanyState` snapshot. +The response contains the updated `epiphanyState`. The durable side effect is a rollout `EpiphanyState` snapshot. The live side effect is a `thread/epiphany/stateUpdated` notification carrying the same updated state to app-server clients. ### Invariant -This is an explicit write surface, not a hidden side effect. It does not run retrieval, indexing, watcher invalidation, automatic graph inference, or specialist-agent scheduling. It is just the clerk with the red pen, finally given a form. +This is an explicit write surface, not a hidden side effect. It does not run retrieval, indexing, watcher invalidation, automatic graph inference, or specialist-agent scheduling. The notification is a reflection of a completed write, not a second writer. It is just the clerk with the red pen, finally given a form. ## Flow 10: Observation Distillation Proposal Control Flow @@ -820,6 +827,7 @@ The app-server handler: 6. maps the patch into `EpiphanyStateUpdate`. 7. calls `CodexThread.epiphany_update_state`. 8. returns the updated `EpiphanyThreadState`. +9. emits `thread/epiphany/stateUpdated` only for the accepted path. `evaluate_promotion` currently enforces a deliberately small but now delta-aware policy: @@ -839,6 +847,7 @@ Code refs: - [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4349) - [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4363) - [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4393) +- [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4417) - [epiphany-core/src/promotion.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/promotion.rs:33) - [epiphany-core/src/promotion.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/promotion.rs:126) - [epiphany-core/src/promotion.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/promotion.rs:157) @@ -846,17 +855,17 @@ Code refs: ### Output -Rejected promotions return reasons and no state. Accepted promotions return the updated `epiphanyState` from the durable update path. +Rejected promotions return reasons and no state. Accepted promotions return the updated `epiphanyState` from the durable update path and emit `thread/epiphany/stateUpdated` with that state. ### Invariant -Promotion is a gate, not independent persistence. It does not write rollout items directly and it does not mutate state on rejection. Accepted promotions still go through `CodexThread.epiphany_update_state`, so the red pen remains one tool, not three tools in a coat. +Promotion is a gate, not independent persistence. It does not write rollout items directly, it does not mutate state on rejection, and rejected promotions emit no state update notification. Accepted promotions still go through `CodexThread.epiphany_update_state`, so the red pen remains one tool, not three tools in a coat. ## Current Non-Flows These are deliberately not shipped yet: -- no live Epiphany event stream. +- no broad live Epiphany event stream beyond `thread/epiphany/stateUpdated` for successful update/promote writes. - no automatic evidence promotion from tool output; the current distill/propose/promote path still requires explicit verifier-backed calls. - no automatic Compact-Rehydrate-Reorient-Continue coordinator; current code preserves and rehydrates valid Epiphany snapshots across resume/rollback/compaction, but reorientation and next-action selection are still enforced by repo-local state, handoff notes, and operating discipline rather than a runtime scheduler. - no watcher-driven graph or semantic invalidation. @@ -877,9 +886,10 @@ stored Epiphany state -> explicit proposal can draft map/churn patches from verified observations -> explicit promotion can reject or accept verified candidates -> explicit update patches can revise durable map/evidence/churn state +-> successful writes emit thread/epiphany/stateUpdated ``` -The current remaining missing organ is not the red pen and not the first chewing motion. Those exist. Proposal now has the first bits of map memory, focus, and selection hygiene: it can auto-select a bounded evidence-backed observation cluster when ids are omitted, requires accepting recent evidence behind selected observations, prioritizes stronger selected observations for proposal wording, reuses existing architecture nodes by concrete code-ref/path/id checks before creating new path nodes, can rescue unanchored graph nodes through strict unique semantic overlap, follows graph links and incident edges into the frontier, and reports match-kind-aware churn pressure from the actual proposal shape. Distillation now also has the first source-output-aware teeth for tool/model summaries. Promotion now notices risky deltas instead of just checking the shape of the envelope, treats graph expansion as risky even if the patch tries to mumble "low pressure" while dragging a new wall into the blueprint, and token-matches strong verifier kinds so `contest` cannot sneak past as `test`. Richer app-server smoke coverage now exists in `tools/epiphany_phase5_smoke.py`; the remaining missing organs are watcher/freshness inputs and eventually role-scoped specialist ownership without silently auto-promoting anything. +The current remaining missing organ is not the red pen, not the first chewing motion, and not the first state-change bell. Those exist. Proposal now has the first bits of map memory, focus, and selection hygiene: it can auto-select a bounded evidence-backed observation cluster when ids are omitted, requires accepting recent evidence behind selected observations, prioritizes stronger selected observations for proposal wording, reuses existing architecture nodes by concrete code-ref/path/id checks before creating new path nodes, can rescue unanchored graph nodes through strict unique semantic overlap, follows graph links and incident edges into the frontier, and reports match-kind-aware churn pressure from the actual proposal shape. Distillation now also has the first source-output-aware teeth for tool/model summaries. Promotion now notices risky deltas instead of just checking the shape of the envelope, treats graph expansion as risky even if the patch tries to mumble "low pressure" while dragging a new wall into the blueprint, and token-matches strong verifier kinds so `contest` cannot sneak past as `test`. Successful update/promote writes now emit `thread/epiphany/stateUpdated` so clients no longer need to poll blindly after every accepted red-pen move. Richer app-server smoke coverage now exists in `tools/epiphany_phase5_smoke.py`; the remaining missing organs are watcher/freshness inputs and eventually role-scoped specialist ownership without silently auto-promoting anything. ```text model/tool observations @@ -888,11 +898,12 @@ model/tool observations -> promotion policy / verifier acceptance -> typed Epiphany state update -> durable evidence/map/churn mutation +-> live stateUpdated notification ``` -The typed write path exists, the first deterministic observation/evidence distillation path exists, source-output-aware distillation now summarizes noisy tool/model output into typed evidence with final result/error/finished lines ahead of generic warnings, the first deterministic map/churn proposal path exists, proposal-quality hardening now auto-selects bounded observation clusters when ids are omitted, requires accepting recent evidence, reuses existing graph nodes by observed code refs, prioritizes stronger selected observations, rescues unanchored graph nodes by strict semantic overlap, focuses linked frontier context, reports match-kind-aware map-delta pressure, and the first verifier-backed promotion gate exists. The first map/churn safety layer also exists: promotion can reject state replacement patches that are not tied to explicit observations/evidence, that contain structurally broken subgoal, invariant, graph, frontier, checkpoint, or churn fields, that try to promote risky churn without a warning and stronger verifier evidence, that claim a graph expansion is low-pressure to dodge the warning gate, or that rely on substring verifier-kind accidents. +The typed write path exists, the first deterministic observation/evidence distillation path exists, source-output-aware distillation now summarizes noisy tool/model output into typed evidence with final result/error/finished lines ahead of generic warnings, the first deterministic map/churn proposal path exists, proposal-quality hardening now auto-selects bounded observation clusters when ids are omitted, requires accepting recent evidence, reuses existing graph nodes by observed code refs, prioritizes stronger selected observations, rescues unanchored graph nodes by strict semantic overlap, focuses linked frontier context, reports match-kind-aware map-delta pressure, and the first verifier-backed promotion gate exists. The first map/churn safety layer also exists: promotion can reject state replacement patches that are not tied to explicit observations/evidence, that contain structurally broken subgoal, invariant, graph, frontier, checkpoint, or churn fields, that try to promote risky churn without a warning and stronger verifier evidence, that claim a graph expansion is low-pressure to dodge the warning gate, or that rely on substring verifier-kind accidents. The first live state notification layer also exists: accepted writes publish updated typed state; rejected promotions stay quiet. -In natural language: current Epiphany can preserve a map, show a map, retrieve evidence for the map, draft one explicit observation/evidence patch, derive a bounded graph/frontier/churn candidate from verified evidence-backed observations with code refs, choose a small coherent observation set when the caller does not provide one, favor the strongest selected observation when drafting that candidate, reject or accept a verified candidate, apply explicit map/evidence/churn edits, and sanity-check those edits before they hit the ledger. It still does not ingest fresh tool/model output into richer map deltas automatically, invalidate stale graph regions, or coordinate specialist ownership. Teeth are installed; chewing is supervised; the next slices are about taste, not jawbones. +In natural language: current Epiphany can preserve a map, show a map, retrieve evidence for the map, draft one explicit observation/evidence patch, derive a bounded graph/frontier/churn candidate from verified evidence-backed observations with code refs, choose a small coherent observation set when the caller does not provide one, favor the strongest selected observation when drafting that candidate, reject or accept a verified candidate, apply explicit map/evidence/churn edits, notify clients after successful writes, and sanity-check those edits before they hit the ledger. It still does not ingest fresh tool/model output into richer map deltas automatically, invalidate stale graph regions, or coordinate specialist ownership. Teeth are installed; chewing is supervised; the first bell rings; the next slices are about taste, not jawbones. ## Verification Hooks @@ -907,9 +918,9 @@ Current tests cover the landed flows at useful seams: - map/churn promotion validation for evidence-backed state replacements in `epiphany-core`. - typed state-update patch application in `codex-core`. - retrieval ranking, fallback, stale manifest detection, and mocked Qdrant/Ollama indexing in `epiphany-core`. -- app-server protocol serde for `thread/epiphany/retrieve`, `thread/epiphany/index`, `thread/epiphany/distill`, `thread/epiphany/propose`, `thread/epiphany/promote`, and `thread/epiphany/update`. +- app-server protocol serde for `thread/epiphany/retrieve`, `thread/epiphany/index`, `thread/epiphany/distill`, `thread/epiphany/propose`, `thread/epiphany/promote`, `thread/epiphany/update`, and `thread/epiphany/stateUpdated`. - app-server mapping of core retrieval/index summaries into protocol responses. -- reusable app-server smoke for the richer Phase 5 chain in `tools/epiphany_phase5_smoke.py`. +- reusable app-server smoke for the richer Phase 5 chain in `tools/epiphany_phase5_smoke.py`, including update/promote `thread/epiphany/stateUpdated` notifications. Useful commands: diff --git a/notes/epiphany-fork-implementation-plan.md b/notes/epiphany-fork-implementation-plan.md index 4d6dac2d..ce2a99fa 100644 --- a/notes/epiphany-fork-implementation-plan.md +++ b/notes/epiphany-fork-implementation-plan.md @@ -2,7 +2,7 @@ ## Status -Updated on 2026-04-25 after live-smoking the richer Phase 5 app-server chain and adding a reusable smoke harness. +Updated on 2026-04-25 after adding the first live typed Epiphany state notification seam on top of the richer Phase 5 app-server chain. This note tracks Epiphany as a fork of Codex with an opinionated modeling architecture. The point is not to offer Codex another collaboration preset. The point is to make the harness force the model to carry explicit structure about the codebase, the active subgoal, the evidence trail, and the machine it is modifying. @@ -28,9 +28,10 @@ This note tracks Epiphany as a fork of Codex with an opinionated modeling archit - an expansion-freshness promotion hardening slice that prevents a graph-expansion patch from bypassing warning requirements by falsely claiming low `diff_pressure` - a token-aware verifier-kind promotion hardening slice that prevents substring accidents such as `contest` from satisfying the risky-delta `test` verifier-kind requirement - a reusable richer Phase 5 app-server smoke harness at `tools/epiphany_phase5_smoke.py` that verifies source-output distillation, read-only proposal, risky-delta rejection, expanded-low-pressure rejection, substring verifier-kind rejection, and accepted promotion through the loaded-thread seam -- current phase: Phase 5 semantic distillation/promotion/proposal machinery +- a first live typed-state notification slice: experimental `thread/epiphany/stateUpdated` fires after successful direct `thread/epiphany/update` and accepted `thread/epiphany/promote`, carrying the updated `epiphanyState` while rejected promotions remain silent and non-mutating +- current phase: post-Phase-5 live typed state/read-surface hardening -The next job is no longer to prove the retriever exists, sketch the persistent follow-up in prose, invent the first red-pen path, build the first observation proposal surface, make promotion notice broken map/churn replacements, ship the first read-only map/churn proposal surface, teach proposal to avoid duplicating already-mapped code surfaces, make proposal frontier focus follow existing graph links, make selected observations evidence-backed with non-haunted churn pressure, rescue unanchored graph nodes with strict semantic matching, let proposal choose a bounded ready observation set when ids are omitted, make proposal pressure understand match kinds, make the distiller summarize noisy source output, make source-output salience prefer final results over generic warnings, make promotion notice risky deltas, make expansion freshness resistant to low-pressure underreporting, prevent substring verifier-kind accidents, or prove that richer chain over app-server by hand. Those parts are landed or live-smoked. The next job is to use the reusable smoke harness as a guardrail before adding the next smallest source-grounded proposal/promotion rule, and to keep `thread/epiphany/retrieve`, `thread/epiphany/distill`, and `thread/epiphany/propose` out of the durable-writer business. +The next job is no longer to prove the retriever exists, sketch the persistent follow-up in prose, invent the first red-pen path, build the first observation proposal surface, make promotion notice broken map/churn replacements, ship the first read-only map/churn proposal surface, teach proposal to avoid duplicating already-mapped code surfaces, make proposal frontier focus follow existing graph links, make selected observations evidence-backed with non-haunted churn pressure, rescue unanchored graph nodes with strict semantic matching, let proposal choose a bounded ready observation set when ids are omitted, make proposal pressure understand match kinds, make the distiller summarize noisy source output, make source-output salience prefer final results over generic warnings, make promotion notice risky deltas, make expansion freshness resistant to low-pressure underreporting, prevent substring verifier-kind accidents, prove that richer chain over app-server by hand, or add the first live state notification after successful writes. Those parts are landed or live-smoked. The next job is to use the reusable smoke harness as a guardrail before adding the next smallest source-grounded notification/read/proposal/promotion rule, and to keep `thread/epiphany/retrieve`, `thread/epiphany/distill`, and `thread/epiphany/propose` out of the durable-writer business. ## Summary @@ -230,6 +231,19 @@ Current bounded shape of that follow-up: - it increments the Epiphany revision, updates `lastUpdatedTurnId` when a reference turn exists, writes live `SessionState`, persists `RolloutItem::EpiphanyState`, and flushes the rollout - rollout replay now accepts an out-of-band Epiphany snapshot before the first real user turn so pre-turn seed updates survive resume +Follow-up addition now landed after the update/promote surfaces: + +- `thread/epiphany/stateUpdated` + +Current bounded shape of that follow-up: + +- it is an experimental server notification, not another write path +- it carries `threadId` plus the full updated `epiphanyState` +- it fires after successful direct `thread/epiphany/update` +- it fires after accepted `thread/epiphany/promote` +- it does not fire for rejected promotions, because rejection still does not mutate state +- the richer app-server smoke now asserts direct update publishes revision `1` and accepted promotion publishes revision `2` + Follow-up addition now landed after the update surface: - `thread/epiphany/distill` @@ -280,16 +294,16 @@ Add tests for: ## Immediate Next Step -Treat the current retrieval baseline and explicit indexing follow-up as landed Phase 4. Treat the explicit update path, distillation proposal path, read-only map/churn proposal path, verifier-backed promotion gate, structural map/churn promotion validation, graph-node reuse, linked frontier focus, evidence-backed selection, map-delta churn pressure, selected-observation prioritization, strict unanchored-node semantic reuse, automatic bounded observation-set selection, match-kind-aware map-delta judgment, source-output-aware observation distillation, source-output salience ranking, risky-delta promotion policy, expansion-freshness promotion hardening, token-aware verifier-kind promotion hardening, and reusable richer app-server smoke harness as the active Phase 5 baseline. The next machine gap is no longer "can Epiphany retrieve code?", "can it propose one durable observation patch?", "can it draft one bounded map/churn candidate?", "can it avoid duplicating an existing graph node when an observation points at already-mapped code?", "can it focus linked graph context?", "can it reject selected observations that are not backed by accepting recent evidence?", "can it use graph language when no concrete refs exist yet?", "can it choose a proposal-ready observation set when ids are omitted?", "can it distinguish exact refinement from same-path broadening or semantic anchoring?", "can it summarize noisy tool/model output as typed evidence?", "can it rank final result/error/finished lines above generic warnings?", "can promotion policy reason over richer deltas without silently writing them?", "can expansion freshness resist low-pressure underreporting?", "can verifier kind matching avoid substring accidents?", or "does the richer Phase 5 chain behave through the app-server seam?" It can. +Treat the current retrieval baseline and explicit indexing follow-up as landed Phase 4. Treat the explicit update path, distillation proposal path, read-only map/churn proposal path, verifier-backed promotion gate, structural map/churn promotion validation, graph-node reuse, linked frontier focus, evidence-backed selection, map-delta churn pressure, selected-observation prioritization, strict unanchored-node semantic reuse, automatic bounded observation-set selection, match-kind-aware map-delta judgment, source-output-aware observation distillation, source-output salience ranking, risky-delta promotion policy, expansion-freshness promotion hardening, token-aware verifier-kind promotion hardening, reusable richer app-server smoke harness, and first `thread/epiphany/stateUpdated` notification seam as the active baseline. The next machine gap is no longer "can Epiphany retrieve code?", "can it propose one durable observation patch?", "can it draft one bounded map/churn candidate?", "can it avoid duplicating an existing graph node when an observation points at already-mapped code?", "can it focus linked graph context?", "can it reject selected observations that are not backed by accepting recent evidence?", "can it use graph language when no concrete refs exist yet?", "can it choose a proposal-ready observation set when ids are omitted?", "can it distinguish exact refinement from same-path broadening or semantic anchoring?", "can it summarize noisy tool/model output as typed evidence?", "can it rank final result/error/finished lines above generic warnings?", "can promotion policy reason over richer deltas without silently writing them?", "can expansion freshness resist low-pressure underreporting?", "can verifier kind matching avoid substring accidents?", "does the richer Phase 5 chain behave through the app-server seam?", or "can successful writes notify a client that typed state changed?" It can. 1. treat the current verified-and-landed query-time hybrid retriever as the Phase 4 slice 1 baseline 2. treat the verified and live-smoked `thread/epiphany/index` slice as the bounded persistent-semantic follow-up 3. keep the new `epiphany-core` boundary honest instead of letting vendored Codex re-accumulate the heavy implementation 4. do not add durable retrieval-summary writes from `thread/epiphany/retrieve` without a clean out-of-band rollout/update semantic -5. continue Phase 5 by hardening the layer above the landed distill/propose/promote/update surfaces: +5. continue post-Phase-5 live typed state/read-surface hardening above the landed distill/propose/promote/update surfaces: - better proposal heuristics beyond the current exact-code-ref, same-path, deterministic-id, graph-link, accepting-evidence, semantic-unanchored-node, selected-priority, auto-selection, and match-kind-aware map-delta-pressure checks - run `tools/epiphany_phase5_smoke.py` as a preflight before changing proposal or promotion policy - - add the next smallest promotion/proposal rule only after a source-grounded gap appears in real use or smoke output + - add the next smallest notification/read/proposal/promotion rule only after a source-grounded gap appears in real use or smoke output - verifier-backed acceptance/rejection evidence - no hidden retrieval writes - not GUI work diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 31af5e6e..22eb1cb7 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -85,12 +85,14 @@ Current verified typed state/promotion layer: - experimental loaded-thread-only `thread/epiphany/distill` - experimental loaded-thread-only `thread/epiphany/promote` - experimental loaded-thread-only `thread/epiphany/propose` +- experimental `thread/epiphany/stateUpdated` notifications after successful direct updates and accepted promotions - typed patch shape for observations, evidence, objective, subgoals, invariants, graphs, graph frontier/checkpoint, scratch, churn, and mode - deterministic observation/evidence proposal generation in `epiphany-core` - observation distillation now keeps noisy tool/command/shell/model output bounded by selecting salient output lines, prioritizing final result/failure/error/finished lines above generic warnings, and defaulting evidence kind to `tool-output` or `model-output` when the caller did not provide one - deterministic map/churn proposal generation in `epiphany-core`, now with first-pass graph-node reuse by exact code-ref, same-path overlap, or deterministic path-node id before new candidate nodes are created, strict semantic reuse for unanchored architecture nodes, linked frontier focus through graph links and named incident edges, evidence-backed selected observations via accepting `recent_evidence`, selected-observation prioritization, automatic bounded observation selection when ids are omitted, and match-kind-aware churn pressure derived from exact-ref refinement, same-path broadening, deterministic-node reuse, semantic anchoring, or new candidate surfaces - verifier-backed promotion policy evaluation in `epiphany-core`, now rejecting risky churn deltas unless they carry explicit warning rationale and strong verifier evidence kind; graph expansion is risky even if a patch understates `diff_pressure`, and strong verifier kinds are token-matched instead of substring-matched - core `CodexThread.epiphany_update_state(...)` applies the patch to live `SessionState`, bumps revision, persists `RolloutItem::EpiphanyState`, and flushes rollout +- app-server now emits `thread/epiphany/stateUpdated` after the direct update path and after accepted promotion return an updated state; rejected promotions still do not mutate state or emit an update notification - replay helpers in both `codex-core` and `epiphany-core` accept an out-of-band Epiphany snapshot before the first real user turn so seed/update snapshots survive resume - retrieval remains read-only and indexing remains the only persistent semantic write path @@ -199,6 +201,7 @@ What is wired right now: - `thread/epiphany/promote` is the first explicit promotion gate; it rejects failed verifier evidence without mutation and applies accepted candidates through the update path - `thread/epiphany/promote` now has a first richer map/churn safety layer: state replacement patches must carry explicit observations and patch evidence, and subgoal/invariant/graph/frontier/checkpoint/churn structure is validated before the durable update path is called - `thread/epiphany/update` is the first explicit durable Epiphany state write surface; it rejects empty patches, supports optional revision matching, appends observations/evidence, replaces bounded typed fields, increments state revision, and persists immediately +- `thread/epiphany/stateUpdated` is the first live typed-state notification surface; it fires only after successful `thread/epiphany/update` and accepted `thread/epiphany/promote`, carrying the full updated `epiphanyState` - live hydrated `thread.epiphanyState` reads now backfill a lightweight retrieval summary when the thread already has Epiphany state but no persisted retrieval summary yet - basic protocol/core/app-server unit tests were added for the new types and mapping layer - the current pushed baseline additionally wires: @@ -355,16 +358,17 @@ If a future session wakes up from compaction and starts bluffing, this is the pa - persistent semantic indexing now exists behind explicit `thread/epiphany/index` - Phase 5 semantic distillation/promotion is active: - dedicated experimental `thread/epiphany/update`, `thread/epiphany/distill`, and `thread/epiphany/promote` exist and are live-smoked + - experimental `thread/epiphany/stateUpdated` now exists and is live-smoked for both direct update and accepted promote paths - structural map/churn promotion validation is landed in `epiphany-core` - proposal selection now rejects observations without accepting `recent_evidence`, and churn pressure now reflects match-kind-aware map-delta shape - proposal can now omit `observationIds` and let `epiphany-core` choose a bounded coherent path cluster from existing verified, evidence-backed observations using source/evidence quality plus graph-frontier focus - proposal churn now distinguishes exact-ref refinements from same-path broadening, deterministic-node reuse, semantic unanchored-node reuse, and new candidate surfaces before setting graph freshness and diff pressure - distillation now summarizes noisy tool/command/shell/model output into salient typed evidence rather than preserving raw output sludge as the summary, and final result/failure/error/finished lines outrank generic warnings unless warning is the only central signal - promotion now rejects medium/high/expanded/broadening/semantic/update churn deltas that lack a warning, carry weak generic verifier evidence, or rely on substring verifier-kind accidents such as `contest` - - richer Phase 5 app-server smoke is now reproducible through `tools/epiphany_phase5_smoke.py`; it verifies `shell-tool` distillation to `tool-output`, read-only proposal, risky-churn rejection without warning, expanded-low-pressure rejection, substring verifier-kind rejection, weak verifier-kind rejection, and accepted promotion only with warning plus strong verifier evidence + - richer Phase 5 app-server smoke is now reproducible through `tools/epiphany_phase5_smoke.py`; it verifies `shell-tool` distillation to `tool-output`, read-only proposal, update notification revision 1, risky-churn rejection without warning, expanded-low-pressure rejection, substring verifier-kind rejection, weak verifier-kind rejection, accepted promotion only with warning plus strong verifier evidence, and promote notification revision 2 - the Epiphany algorithmic map has been semantically audited flow-by-flow against the cited code; stale line anchors were fixed, and the current typed spine still describes a coherent machine - the next bounded follow-up should use the richer smoke harness as a guardrail before the next source-grounded proposal/promotion hardening slice -- There is still no live `thread/epiphany/*` notification stream. +- There is now a first live `thread/epiphany/stateUpdated` notification seam for successful update/promote writes; there is still no broader watcher/job/specialist event stream. - The next phase is **not** GUI work. - The current pushed baseline also extracted most Epiphany-owned implementation into `epiphany-core`: - prompt rendering, rollout replay, and retrieval/indexing logic are now repo-owned @@ -460,16 +464,16 @@ Without that, you get to learn about `symlink_dir failed: ... A required privile Do not restart verification from superstition. Phase 4 retrieval/indexing/core-extraction is already verified, committed, and pushed. Phase 5 distill/propose/promote/update, the first structural promotion safety layer, graph-node reuse, linked frontier focus, evidence-backed proposal selection, selected-observation prioritization, strict unanchored-node semantic reuse, automatic bounded observation selection, match-kind-aware map-delta churn pressure, source-output-aware distillation, risky-delta promotion policy, expansion-freshness promotion hardening, token-aware verifier-kind promotion hardening, and the reusable richer app-server smoke harness are also landed. -The durable state seam exists, the turn loop reads it, clients can load typed Epiphany state directly, the first retrieval slice is real, the explicit persistent-semantic indexing path is landed, the distill/propose/promote/update path is live-smoked, promotion now has a first structural map/churn safety layer and risky-delta policy with token-aware verifier-kind matching, distillation summarizes noisy source output into typed evidence, and proposal now reuses existing architecture nodes before creating new path nodes, expands frontier focus through linked graph context, rejects selected observations without accepting recent evidence, prioritizes stronger selected observations for proposal wording, can reuse unanchored architecture nodes through strict semantic overlap, can auto-select a bounded evidence-backed observation cluster when ids are omitted, and reports match-kind-aware churn pressure from the proposal shape. The richer Phase 5 chain has now been smoke-tested through app-server and captured as a reusable tool instead of a one-off ritual. +The durable state seam exists, the turn loop reads it, clients can load typed Epiphany state directly, successful writes now publish a live typed `thread/epiphany/stateUpdated` notification, the first retrieval slice is real, the explicit persistent-semantic indexing path is landed, the distill/propose/promote/update path is live-smoked, promotion now has a first structural map/churn safety layer and risky-delta policy with token-aware verifier-kind matching, distillation summarizes noisy source output into typed evidence, and proposal now reuses existing architecture nodes before creating new path nodes, expands frontier focus through linked graph context, rejects selected observations without accepting recent evidence, prioritizes stronger selected observations for proposal wording, can reuse unanchored architecture nodes through strict semantic overlap, can auto-select a bounded evidence-backed observation cluster when ids are omitted, and reports match-kind-aware churn pressure from the proposal shape. The richer Phase 5 chain has now been smoke-tested through app-server and captured as a reusable tool instead of a one-off ritual. Current Phase 5 implementation move: 1. treat the live-smoked retrieval/indexing baseline as Phase 4 and the typed update/distill/propose/promote surfaces as the active Phase 5 baseline 2. keep the current env/default Qdrant/Ollama config surface for now 3. keep `thread/epiphany/retrieve`, `thread/epiphany/distill`, and `thread/epiphany/propose` read-only -4. continue Phase 5 by hardening the next layer above the distill/propose/promote/update surfaces: +4. continue the next bounded live typed-state/read-surface slice above the distill/propose/promote/update surfaces: - run `tools/epiphany_phase5_smoke.py` before changing proposal or promotion policy - - add the next smallest promotion/proposal rule only after a source-grounded gap appears in real use or smoke output + - add the next smallest notification/read/proposal/promotion rule only after a source-grounded gap appears in real use or smoke output - verifier-backed acceptance/rejection evidence - no GUI, watcher, or specialist-agent machinery yet @@ -511,4 +515,4 @@ cmd /c "\"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxi The repo is in a good state. -Phase 1, Phase 2, the minimal Phase 3 typed read surface, Phase 4 retrieval/indexing/core-extraction, and the current Phase 5 distill/propose/promote/update baseline are landed and verified. `vendor/codex` is first-class in the parent repo now, with the heavier Epiphany organs living in `epiphany-core`. Read-only distillation now summarizes noisy tool/model output into typed evidence and ranks final result/error/finished lines above generic warnings, read-only proposal can auto-select a bounded evidence-backed observation cluster and report match-kind-aware map-delta pressure, promotion rejects risky deltas without warning plus strong verifier evidence, expansion freshness cannot bypass warning requirements by claiming low pressure, and verifier kinds are token-matched so `contest` does not pass as `test`. The current Epiphany algorithmic map has been source-audited against the code flow it describes. The richer Phase 5 chain is now live-smoked through app-server by `tools/epiphany_phase5_smoke.py`, including the expanded-low-pressure and substring-verifier rejection checks. The next clean move is the next source-grounded proposal/promotion hardening slice, with that smoke harness as a guardrail; not GUI paint, watcher magic, or re-proving retrieval. Pre-compaction persistence is now an explicit design rule, not a lucky habit. +Phase 1, Phase 2, the minimal Phase 3 typed read surface, Phase 4 retrieval/indexing/core-extraction, and the current Phase 5 distill/propose/promote/update baseline are landed and verified. `vendor/codex` is first-class in the parent repo now, with the heavier Epiphany organs living in `epiphany-core`. Successful direct updates and accepted promotions now emit experimental `thread/epiphany/stateUpdated` notifications carrying the updated typed state. Read-only distillation now summarizes noisy tool/model output into typed evidence and ranks final result/error/finished lines above generic warnings, read-only proposal can auto-select a bounded evidence-backed observation cluster and report match-kind-aware map-delta pressure, promotion rejects risky deltas without warning plus strong verifier evidence, expansion freshness cannot bypass warning requirements by claiming low pressure, and verifier kinds are token-matched so `contest` does not pass as `test`. The current Epiphany algorithmic map has been source-audited against the code flow it describes. The richer Phase 5 chain is now live-smoked through app-server by `tools/epiphany_phase5_smoke.py`, including update notification revision 1, expanded-low-pressure and substring-verifier rejection checks, accepted promotion, and promote notification revision 2. The next clean move is the next bounded live typed-state/read-surface hardening slice, with that smoke harness as a guardrail; not GUI paint, watcher magic, or re-proving retrieval. Pre-compaction persistence is now an explicit design rule, not a lucky habit. diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 15437f07..e82b88a9 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -132,3 +132,5 @@ {"ts": "2026-04-25T03:55:24+00:00", "type": "verification", "status": "ok", "note": "Verified expansion-freshness promotion hardening with py_compile for tools/epiphany_phase5_smoke.py, cargo fmt --manifest-path .\\epiphany-core\\Cargo.toml, cargo test --manifest-path .\\epiphany-core\\Cargo.toml promotion::tests (10 tests), full cargo test --manifest-path .\\epiphany-core\\Cargo.toml (44 tests), rebuilt codex-app-server with CARGO_TARGET_DIR=C:\\Users\\Meta\\.cargo-target-codex, and reran tools/epiphany_phase5_smoke.py. Smoke now rejects expanded-low-pressure churn without warning through the app-server seam while preserving the existing read-only proposal and risky promotion checks."} {"ts": "2026-04-25T04:03:52+00:00", "type": "implementation", "status": "ok", "note": "Landed token-aware verifier-kind promotion hardening. epiphany-core now accepts strong risky-delta verifier kinds only as normalized tokens (verification/verifier/test/tests/smoke/review) instead of substring matches, so values such as contest no longer satisfy the test verifier requirement."} {"ts": "2026-04-25T04:03:52+00:00", "type": "verification", "status": "ok", "note": "Verified token-aware verifier-kind promotion hardening with py_compile for tools/epiphany_phase5_smoke.py, cargo fmt --manifest-path .\\epiphany-core\\Cargo.toml, cargo test --manifest-path .\\epiphany-core\\Cargo.toml promotion::tests (11 tests), full cargo test --manifest-path .\\epiphany-core\\Cargo.toml (45 tests), rebuilt codex-app-server with CARGO_TARGET_DIR=C:\\Users\\Meta\\.cargo-target-codex, and reran tools/epiphany_phase5_smoke.py. Smoke now rejects verifierEvidence.kind=contest for risky churn while preserving accepted strong verification evidence."} +{"ts": "2026-04-25T04:31:41+00:00", "type": "verification", "status": "ok", "note": "Verified live state notification slice with py_compile for tools/epiphany_phase5_smoke.py, targeted cargo test -p codex-app-server-protocol --lib thread_epiphany (14 tests), rebuilt codex-app-server with CARGO_TARGET_DIR=C:\\Users\\Meta\\.cargo-target-codex, and reran tools/epiphany_phase5_smoke.py. Smoke observed updateNotificationRevision=1 and promoteNotificationRevision=2 while preserving read-only proposal and rejected-promotion behavior."} +{"ts": "2026-04-25T04:32:27+00:00", "type": "implementation", "status": "ok", "note": "Landed first live Epiphany typed-state notification seam. App-server protocol now declares experimental thread/epiphany/stateUpdated, direct thread/epiphany/update emits it after successful state persistence, accepted thread/epiphany/promote emits it after the durable update path, and rejected promotions remain non-mutating and silent."} diff --git a/state/map.yaml b/state/map.yaml index cf4c0eb8..e2fcf32c 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -1,7 +1,7 @@ experiment: name: EpiphanyAgent status: scaffolded - phase: manual_external_typed_state + phase: live_typed_state_stream premise: > Test whether separating map, scratch, and output reduces architectural drift for coding tasks when using a strong general model. @@ -46,10 +46,10 @@ data_flow: - commit or backtrack active_subgoals: - - Keep the Phase 5 distill/propose/promote/update work aligned with reality in code and repo memory. + - Keep the Phase 5 distill/propose/promote/update work and first live state notification seam aligned with reality in code and repo memory. - Keep vendored Codex as a thin typed host seam while Epiphany-owned prompt and retrieval/indexing logic live in the repo-owned `epiphany-core` crate. - Preserve exact/path lookup and BM25 fallback while the Qdrant path stays explicit and bounded. - - Use the reusable richer Phase 5 app-server smoke harness as a guardrail before the next proposal/promotion hardening slice, keeping retrieval/distill/propose read-only and accepted writes routed through promotion/update. + - Continue post-Phase-5 live typed state/read-surface hardening while keeping retrieval/distill/propose read-only and accepted writes routed through promotion/update. accepted_design: - external typed state files @@ -108,6 +108,7 @@ accepted_design: - harden source-output distillation salience ranking incrementally: final test result, failure, error, exit-code, passed, and finished lines outrank generic warnings when compressing noisy tool output, while warning-only output still preserves the warning as the central signal - harden promotion policy incrementally: `thread/epiphany/promote` should reject risky churn deltas unless they carry explicit warning rationale and strong verifier evidence kind, treating graph expansion, broadening, semantic anchoring, updates, and medium/high pressure as risky even when a patch tries to understate pressure; strong verifier kinds are token-matched so substring accidents such as `contest` do not satisfy `test` - live-smoke the richer Phase 5 app-server chain with a reusable repo-local harness: source-output distillation produced `tool-output` with final result lines ahead of generic warnings, proposal stayed read-only, risky churn rejected without warning, expansion-with-low-pressure churn rejected without warning, risky churn rejected with weak or substring verifier evidence, and accepted risky churn persisted only with warning plus strong verifier evidence + - land the first live Epiphany state notification seam: experimental `thread/epiphany/stateUpdated` publishes the updated typed state after successful direct `thread/epiphany/update` and accepted `thread/epiphany/promote`, while rejected promotions still do not mutate state or emit update notifications rejected_paths: - name: pinned_map_only @@ -124,5 +125,5 @@ rejected_paths: reason: audited candidates were either terminal-only, stale/aspirational, or incoherent wrappers; the comparison clones were removed from vendor to avoid building on untrusted drift current_status: - summary: Workspace initialized with protocol files, typed state, handoff notes, architecture maps, and a rolling implementation plan against vendored Codex. Phase 1 durable state, Phase 2 prompt integration, the minimal Phase 3 typed read surface, and Phase 4 retrieval/indexing/core-extraction are landed on `main`. Phase 5 semantic distillation/promotion/proposal is now active: the current baseline includes explicit Qdrant indexing with BM25 fallback, typed `thread/epiphany/update`, read-only `thread/epiphany/distill`, read-only `thread/epiphany/propose`, verifier-backed `thread/epiphany/promote`, structural map/churn promotion validation, source-output-aware distillation with result/error/finished lines prioritized over generic warnings, graph-node reuse, linked frontier focus, evidence-backed proposal selection, selected-observation prioritization, strict unanchored-node semantic reuse, automatic bounded observation selection, match-kind-aware map-delta churn pressure, risky-delta promotion policy in `epiphany-core`, expansion-freshness promotion hardening so new map surfaces cannot bypass warning requirements by claiming low pressure, token-aware verifier-kind matching so substring accidents cannot satisfy strong verifier evidence, a reusable richer Phase 5 app-server smoke harness, and thin vendored Codex host seams. The richer smoke now verifies source-output distillation, read-only proposal, risky-delta rejection, expanded-low-pressure rejection, weak-verifier rejection, substring-verifier rejection, and accepted promotion through the app-server seam. The Windows app-server stack-pressure regression was narrowed to test-thread stack size; repo-local Cargo config sets `RUST_MIN_STACK=67108864`, and boxed-future request-dispatch experiments were removed after config-only verification passed. The repo also has source-available/commercial licensing plus a CLA gate for external contributions. - next_action: Use the reusable richer Phase 5 app-server smoke harness as a preflight, then land the next smallest source-grounded proposal/promotion hardening slice that real use exposes; keep retrieval/distillation/proposal read-only and avoid GUI, watcher, or specialist-agent machinery. + summary: Workspace initialized with protocol files, typed state, handoff notes, architecture maps, and a rolling implementation plan against vendored Codex. Phase 1 durable state, Phase 2 prompt integration, the minimal Phase 3 typed read surface, and Phase 4 retrieval/indexing/core-extraction are landed on `main`. Phase 5 semantic distillation/promotion/proposal is now active and chewed enough for the first live typed-state stream seam: the current baseline includes explicit Qdrant indexing with BM25 fallback, typed `thread/epiphany/update`, read-only `thread/epiphany/distill`, read-only `thread/epiphany/propose`, verifier-backed `thread/epiphany/promote`, experimental `thread/epiphany/stateUpdated` notifications after successful direct updates and accepted promotions, structural map/churn promotion validation, source-output-aware distillation with result/error/finished lines prioritized over generic warnings, graph-node reuse, linked frontier focus, evidence-backed proposal selection, selected-observation prioritization, strict unanchored-node semantic reuse, automatic bounded observation selection, match-kind-aware map-delta churn pressure, risky-delta promotion policy in `epiphany-core`, expansion-freshness promotion hardening so new map surfaces cannot bypass warning requirements by claiming low pressure, token-aware verifier-kind matching so substring accidents cannot satisfy strong verifier evidence, a reusable richer Phase 5 app-server smoke harness, and thin vendored Codex host seams. The richer smoke now verifies source-output distillation, read-only proposal, update notification revision 1, risky-delta rejection, expanded-low-pressure rejection, weak-verifier rejection, substring-verifier rejection, accepted promotion, and promote notification revision 2 through the app-server seam. The Windows app-server stack-pressure regression was narrowed to test-thread stack size; repo-local Cargo config sets `RUST_MIN_STACK=67108864`, and boxed-future request-dispatch experiments were removed after config-only verification passed. The repo also has source-available/commercial licensing plus a CLA gate for external contributions. + next_action: Continue the next bounded live typed-state/read-surface hardening slice from the now-notified update/promote seam; keep retrieval/distillation/proposal read-only, keep accepted writes routed through promotion/update, and avoid GUI, watcher, or specialist-agent machinery. diff --git a/tools/epiphany_phase5_smoke.py b/tools/epiphany_phase5_smoke.py index c91cb008..880aebed 100644 --- a/tools/epiphany_phase5_smoke.py +++ b/tools/epiphany_phase5_smoke.py @@ -34,6 +34,7 @@ class AppServerClient: self.transcript_path = transcript_path self.stderr_path = stderr_path self.messages: queue.Queue[dict[str, Any]] = queue.Queue() + self.notifications: list[dict[str, Any]] = [] self.next_id = 1 self.proc: subprocess.Popen[str] | None = None self.transcript = None @@ -129,6 +130,26 @@ class AppServerClient: return result raise TimeoutError(f"timed out waiting for response {request_id}") + def wait_for_notification( + self, + method: str, + *, + start_index: int = 0, + timeout: float = 10.0, + ) -> dict[str, Any]: + assert self.proc is not None + deadline = time.time() + timeout + while time.time() < deadline: + if self.proc.poll() is not None: + raise RuntimeError( + f"app-server exited with {self.proc.returncode} before notification {method}" + ) + for msg in self.notifications[start_index:]: + if msg.get("method") == method: + return msg + time.sleep(0.1) + raise TimeoutError(f"timed out waiting for notification {method}") + def _read_stdout(self) -> None: assert self.proc is not None and self.proc.stdout is not None for line in self.proc.stdout: @@ -140,6 +161,8 @@ class AppServerClient: except json.JSONDecodeError as exc: msg = {"_decode_error": str(exc), "raw": line} self._record("received", msg) + if "method" in msg and "id" not in msg: + self.notifications.append(msg) self.messages.put(msg) def _read_stderr(self) -> None: @@ -250,12 +273,25 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]: "distill summary should prioritize final results over generic warnings", ) + update_notification_start = len(client.notifications) update = client.send( "thread/epiphany/update", {"threadId": thread_id, "expectedRevision": 0, "patch": distill_patch}, ) assert update is not None require(update["epiphanyState"]["revision"] == 1, "update should advance revision to 1") + update_notification = client.wait_for_notification( + "thread/epiphany/stateUpdated", + start_index=update_notification_start, + ) + require( + update_notification["params"]["threadId"] == thread_id, + "update notification should identify the thread", + ) + require( + update_notification["params"]["epiphanyState"]["revision"] == 1, + "update notification should publish revision 1", + ) propose = client.send("thread/epiphany/propose", {"threadId": thread_id}) assert propose is not None @@ -402,6 +438,7 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]: "weak-kind rejection should not mutate state", ) + promote_notification_start = len(client.notifications) accepted = client.send( "thread/epiphany/promote", { @@ -420,6 +457,18 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]: require(accepted["accepted"], "strong verifier should accept risky churn with warning") final_state = accepted["epiphanyState"] require(final_state["revision"] == 2, "accepted promotion should advance revision to 2") + promote_notification = client.wait_for_notification( + "thread/epiphany/stateUpdated", + start_index=promote_notification_start, + ) + require( + promote_notification["params"]["threadId"] == thread_id, + "promote notification should identify the thread", + ) + require( + promote_notification["params"]["epiphanyState"]["revision"] == 2, + "promote notification should publish revision 2", + ) require( final_state["churn"]["diff_pressure"] == "medium", "accepted state should preserve risky churn pressure", @@ -440,6 +489,9 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]: "distillEvidenceId": evidence["id"], "distillEvidenceKind": evidence["kind"], "distillSummary": evidence["summary"], + "updateNotificationRevision": update_notification["params"]["epiphanyState"][ + "revision" + ], "proposalExpectedRevision": propose["expectedRevision"], "proposalObservationId": proposal_patch["observations"][0]["id"], "proposalChurn": proposal_patch["churn"], @@ -454,6 +506,9 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]: "substringVerifierReasons": reject_substring_verifier["reasons"], "accepted": accepted["accepted"], "finalRevision": final_state["revision"], + "promoteNotificationRevision": promote_notification["params"]["epiphanyState"][ + "revision" + ], "finalChurn": final_state["churn"], "graphNodeCount": len( final_state.get("graphs", {}).get("architecture", {}).get("nodes", []) diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/ServerNotification.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/ServerNotification.json index 1194a9b6..97f0b896 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/ServerNotification.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/ServerNotification.json @@ -3712,6 +3712,21 @@ ], "type": "object" }, + "ThreadEpiphanyStateUpdatedNotification": { + "properties": { + "epiphanyState": { + "$ref": "#/definitions/EpiphanyThreadState" + }, + "threadId": { + "type": "string" + } + }, + "required": [ + "epiphanyState", + "threadId" + ], + "type": "object" + }, "ThreadId": { "type": "string" }, @@ -6134,6 +6149,26 @@ "title": "ConfigWarningNotification", "type": "object" }, + { + "properties": { + "method": { + "enum": [ + "thread/epiphany/stateUpdated" + ], + "title": "Thread/epiphany/stateUpdatedNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/ThreadEpiphanyStateUpdatedNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Thread/epiphany/stateUpdatedNotification", + "type": "object" + }, { "properties": { "method": { diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json index d7236335..75d2d465 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json @@ -4504,6 +4504,26 @@ "title": "ConfigWarningNotification", "type": "object" }, + { + "properties": { + "method": { + "enum": [ + "thread/epiphany/stateUpdated" + ], + "title": "Thread/epiphany/stateUpdatedNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/v2/ThreadEpiphanyStateUpdatedNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Thread/epiphany/stateUpdatedNotification", + "type": "object" + }, { "properties": { "method": { @@ -14946,6 +14966,23 @@ ], "type": "object" }, + "ThreadEpiphanyStateUpdatedNotification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "epiphanyState": { + "$ref": "#/definitions/v2/EpiphanyThreadState" + }, + "threadId": { + "type": "string" + } + }, + "required": [ + "epiphanyState", + "threadId" + ], + "title": "ThreadEpiphanyStateUpdatedNotification", + "type": "object" + }, "ThreadEpiphanyUpdatePatch": { "properties": { "activeSubgoalId": { diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json index 2d2ebb81..b98e81e4 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json @@ -11562,6 +11562,26 @@ "title": "ConfigWarningNotification", "type": "object" }, + { + "properties": { + "method": { + "enum": [ + "thread/epiphany/stateUpdated" + ], + "title": "Thread/epiphany/stateUpdatedNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/ThreadEpiphanyStateUpdatedNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Thread/epiphany/stateUpdatedNotification", + "type": "object" + }, { "properties": { "method": { @@ -12833,6 +12853,23 @@ ], "type": "object" }, + "ThreadEpiphanyStateUpdatedNotification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "epiphanyState": { + "$ref": "#/definitions/EpiphanyThreadState" + }, + "threadId": { + "type": "string" + } + }, + "required": [ + "epiphanyState", + "threadId" + ], + "title": "ThreadEpiphanyStateUpdatedNotification", + "type": "object" + }, "ThreadEpiphanyUpdatePatch": { "properties": { "activeSubgoalId": { diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadEpiphanyStateUpdatedNotification.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadEpiphanyStateUpdatedNotification.json new file mode 100644 index 00000000..74aa9b9f --- /dev/null +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadEpiphanyStateUpdatedNotification.json @@ -0,0 +1,723 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "EpiphanyChurnState": { + "properties": { + "diff_pressure": { + "type": "string" + }, + "graph_freshness": { + "type": [ + "string", + "null" + ] + }, + "understanding_status": { + "type": "string" + }, + "unexplained_writes": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "warning": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "diff_pressure", + "understanding_status" + ], + "type": "object" + }, + "EpiphanyCodeRef": { + "properties": { + "end_line": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "note": { + "type": [ + "string", + "null" + ] + }, + "path": { + "type": "string" + }, + "start_line": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "symbol": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "path" + ], + "type": "object" + }, + "EpiphanyEvidenceRecord": { + "properties": { + "code_refs": { + "items": { + "$ref": "#/definitions/EpiphanyCodeRef" + }, + "type": "array" + }, + "id": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "status": { + "type": "string" + }, + "summary": { + "type": "string" + } + }, + "required": [ + "id", + "kind", + "status", + "summary" + ], + "type": "object" + }, + "EpiphanyGraph": { + "properties": { + "edges": { + "items": { + "$ref": "#/definitions/EpiphanyGraphEdge" + }, + "type": "array" + }, + "nodes": { + "items": { + "$ref": "#/definitions/EpiphanyGraphNode" + }, + "type": "array" + } + }, + "type": "object" + }, + "EpiphanyGraphCheckpoint": { + "properties": { + "checkpoint_id": { + "type": "string" + }, + "frontier_node_ids": { + "items": { + "type": "string" + }, + "type": "array" + }, + "graph_revision": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "open_gap_ids": { + "items": { + "type": "string" + }, + "type": "array" + }, + "open_question_ids": { + "items": { + "type": "string" + }, + "type": "array" + }, + "summary": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "checkpoint_id", + "graph_revision" + ], + "type": "object" + }, + "EpiphanyGraphEdge": { + "properties": { + "code_refs": { + "items": { + "$ref": "#/definitions/EpiphanyCodeRef" + }, + "type": "array" + }, + "id": { + "type": [ + "string", + "null" + ] + }, + "kind": { + "type": "string" + }, + "label": { + "type": [ + "string", + "null" + ] + }, + "mechanism": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": "string" + }, + "target_id": { + "type": "string" + } + }, + "required": [ + "kind", + "source_id", + "target_id" + ], + "type": "object" + }, + "EpiphanyGraphFrontier": { + "properties": { + "active_edge_ids": { + "items": { + "type": "string" + }, + "type": "array" + }, + "active_node_ids": { + "items": { + "type": "string" + }, + "type": "array" + }, + "dirty_paths": { + "items": { + "type": "string" + }, + "type": "array" + }, + "open_gap_ids": { + "items": { + "type": "string" + }, + "type": "array" + }, + "open_question_ids": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, + "EpiphanyGraphLink": { + "properties": { + "architecture_node_id": { + "type": "string" + }, + "code_refs": { + "items": { + "$ref": "#/definitions/EpiphanyCodeRef" + }, + "type": "array" + }, + "dataflow_node_id": { + "type": "string" + }, + "relationship": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "architecture_node_id", + "dataflow_node_id" + ], + "type": "object" + }, + "EpiphanyGraphNode": { + "properties": { + "code_refs": { + "items": { + "$ref": "#/definitions/EpiphanyCodeRef" + }, + "type": "array" + }, + "id": { + "type": "string" + }, + "mechanism": { + "type": [ + "string", + "null" + ] + }, + "metaphor": { + "type": [ + "string", + "null" + ] + }, + "purpose": { + "type": "string" + }, + "status": { + "type": [ + "string", + "null" + ] + }, + "title": { + "type": "string" + } + }, + "required": [ + "id", + "purpose", + "title" + ], + "type": "object" + }, + "EpiphanyGraphs": { + "properties": { + "architecture": { + "$ref": "#/definitions/EpiphanyGraph" + }, + "dataflow": { + "$ref": "#/definitions/EpiphanyGraph" + }, + "links": { + "items": { + "$ref": "#/definitions/EpiphanyGraphLink" + }, + "type": "array" + } + }, + "type": "object" + }, + "EpiphanyInvariant": { + "properties": { + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "rationale": { + "type": [ + "string", + "null" + ] + }, + "status": { + "type": "string" + } + }, + "required": [ + "description", + "id", + "status" + ], + "type": "object" + }, + "EpiphanyModeState": { + "properties": { + "kind": { + "anyOf": [ + { + "$ref": "#/definitions/ModeKind" + }, + { + "type": "null" + } + ] + }, + "name": { + "type": "string" + } + }, + "required": [ + "name" + ], + "type": "object" + }, + "EpiphanyObservation": { + "properties": { + "code_refs": { + "items": { + "$ref": "#/definitions/EpiphanyCodeRef" + }, + "type": "array" + }, + "evidence_ids": { + "items": { + "type": "string" + }, + "type": "array" + }, + "id": { + "type": "string" + }, + "source_kind": { + "type": "string" + }, + "status": { + "type": "string" + }, + "summary": { + "type": "string" + } + }, + "required": [ + "id", + "source_kind", + "status", + "summary" + ], + "type": "object" + }, + "EpiphanyRetrievalShardSummary": { + "properties": { + "exact_available": { + "type": "boolean" + }, + "indexed_chunk_count": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "indexed_file_count": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "path_prefix": { + "type": "string" + }, + "semantic_available": { + "type": "boolean" + }, + "shard_id": { + "type": "string" + }, + "status": { + "allOf": [ + { + "$ref": "#/definitions/EpiphanyRetrievalStatus" + } + ], + "default": "unavailable" + } + }, + "required": [ + "path_prefix", + "shard_id" + ], + "type": "object" + }, + "EpiphanyRetrievalState": { + "properties": { + "dirty_paths": { + "items": { + "type": "string" + }, + "type": "array" + }, + "index_revision": { + "type": [ + "string", + "null" + ] + }, + "indexed_chunk_count": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "indexed_file_count": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "last_indexed_at_unix_seconds": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "semantic_available": { + "type": "boolean" + }, + "shards": { + "items": { + "$ref": "#/definitions/EpiphanyRetrievalShardSummary" + }, + "type": "array" + }, + "status": { + "allOf": [ + { + "$ref": "#/definitions/EpiphanyRetrievalStatus" + } + ], + "default": "unavailable" + }, + "workspace_root": { + "type": "string" + } + }, + "required": [ + "workspace_root" + ], + "type": "object" + }, + "EpiphanyRetrievalStatus": { + "enum": [ + "unavailable", + "ready", + "stale", + "indexing" + ], + "type": "string" + }, + "EpiphanyScratchPad": { + "properties": { + "hypothesis": { + "type": [ + "string", + "null" + ] + }, + "next_probe": { + "type": [ + "string", + "null" + ] + }, + "notes": { + "items": { + "type": "string" + }, + "type": "array" + }, + "summary": { + "type": [ + "string", + "null" + ] + } + }, + "type": "object" + }, + "EpiphanySubgoal": { + "properties": { + "id": { + "type": "string" + }, + "status": { + "type": "string" + }, + "summary": { + "type": [ + "string", + "null" + ] + }, + "title": { + "type": "string" + } + }, + "required": [ + "id", + "status", + "title" + ], + "type": "object" + }, + "EpiphanyThreadState": { + "properties": { + "active_subgoal_id": { + "type": [ + "string", + "null" + ] + }, + "churn": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyChurnState" + }, + { + "type": "null" + } + ] + }, + "graph_checkpoint": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyGraphCheckpoint" + }, + { + "type": "null" + } + ] + }, + "graph_frontier": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyGraphFrontier" + }, + { + "type": "null" + } + ] + }, + "graphs": { + "$ref": "#/definitions/EpiphanyGraphs" + }, + "invariants": { + "items": { + "$ref": "#/definitions/EpiphanyInvariant" + }, + "type": "array" + }, + "last_updated_turn_id": { + "type": [ + "string", + "null" + ] + }, + "mode": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyModeState" + }, + { + "type": "null" + } + ] + }, + "objective": { + "type": [ + "string", + "null" + ] + }, + "observations": { + "items": { + "$ref": "#/definitions/EpiphanyObservation" + }, + "type": "array" + }, + "recent_evidence": { + "items": { + "$ref": "#/definitions/EpiphanyEvidenceRecord" + }, + "type": "array" + }, + "retrieval": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyRetrievalState" + }, + { + "type": "null" + } + ] + }, + "revision": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "scratch": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyScratchPad" + }, + { + "type": "null" + } + ] + }, + "subgoals": { + "items": { + "$ref": "#/definitions/EpiphanySubgoal" + }, + "type": "array" + } + }, + "required": [ + "revision" + ], + "type": "object" + }, + "ModeKind": { + "description": "Initial collaboration mode to use when the TUI starts.", + "enum": [ + "plan", + "default" + ], + "type": "string" + } + }, + "properties": { + "epiphanyState": { + "$ref": "#/definitions/EpiphanyThreadState" + }, + "threadId": { + "type": "string" + } + }, + "required": [ + "epiphanyState", + "threadId" + ], + "title": "ThreadEpiphanyStateUpdatedNotification", + "type": "object" +} \ No newline at end of file diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts b/vendor/codex/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts index 614dd611..04e8aa77 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts +++ b/vendor/codex/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts @@ -39,6 +39,7 @@ import type { SkillsChangedNotification } from "./v2/SkillsChangedNotification"; import type { TerminalInteractionNotification } from "./v2/TerminalInteractionNotification"; import type { ThreadArchivedNotification } from "./v2/ThreadArchivedNotification"; import type { ThreadClosedNotification } from "./v2/ThreadClosedNotification"; +import type { ThreadEpiphanyStateUpdatedNotification } from "./v2/ThreadEpiphanyStateUpdatedNotification"; import type { ThreadNameUpdatedNotification } from "./v2/ThreadNameUpdatedNotification"; import type { ThreadRealtimeClosedNotification } from "./v2/ThreadRealtimeClosedNotification"; import type { ThreadRealtimeErrorNotification } from "./v2/ThreadRealtimeErrorNotification"; @@ -63,4 +64,4 @@ import type { WindowsWorldWritableWarningNotification } from "./v2/WindowsWorldW /** * Notification sent from the server to the client. */ -export type ServerNotification = { "method": "error", "params": ErrorNotification } | { "method": "thread/started", "params": ThreadStartedNotification } | { "method": "thread/status/changed", "params": ThreadStatusChangedNotification } | { "method": "thread/archived", "params": ThreadArchivedNotification } | { "method": "thread/unarchived", "params": ThreadUnarchivedNotification } | { "method": "thread/closed", "params": ThreadClosedNotification } | { "method": "skills/changed", "params": SkillsChangedNotification } | { "method": "thread/name/updated", "params": ThreadNameUpdatedNotification } | { "method": "thread/tokenUsage/updated", "params": ThreadTokenUsageUpdatedNotification } | { "method": "turn/started", "params": TurnStartedNotification } | { "method": "hook/started", "params": HookStartedNotification } | { "method": "turn/completed", "params": TurnCompletedNotification } | { "method": "hook/completed", "params": HookCompletedNotification } | { "method": "turn/diff/updated", "params": TurnDiffUpdatedNotification } | { "method": "turn/plan/updated", "params": TurnPlanUpdatedNotification } | { "method": "item/started", "params": ItemStartedNotification } | { "method": "item/autoApprovalReview/started", "params": ItemGuardianApprovalReviewStartedNotification } | { "method": "item/autoApprovalReview/completed", "params": ItemGuardianApprovalReviewCompletedNotification } | { "method": "item/completed", "params": ItemCompletedNotification } | { "method": "rawResponseItem/completed", "params": RawResponseItemCompletedNotification } | { "method": "item/agentMessage/delta", "params": AgentMessageDeltaNotification } | { "method": "item/plan/delta", "params": PlanDeltaNotification } | { "method": "command/exec/outputDelta", "params": CommandExecOutputDeltaNotification } | { "method": "item/commandExecution/outputDelta", "params": CommandExecutionOutputDeltaNotification } | { "method": "item/commandExecution/terminalInteraction", "params": TerminalInteractionNotification } | { "method": "item/fileChange/outputDelta", "params": FileChangeOutputDeltaNotification } | { "method": "item/fileChange/patchUpdated", "params": FileChangePatchUpdatedNotification } | { "method": "serverRequest/resolved", "params": ServerRequestResolvedNotification } | { "method": "item/mcpToolCall/progress", "params": McpToolCallProgressNotification } | { "method": "mcpServer/oauthLogin/completed", "params": McpServerOauthLoginCompletedNotification } | { "method": "mcpServer/startupStatus/updated", "params": McpServerStatusUpdatedNotification } | { "method": "account/updated", "params": AccountUpdatedNotification } | { "method": "account/rateLimits/updated", "params": AccountRateLimitsUpdatedNotification } | { "method": "app/list/updated", "params": AppListUpdatedNotification } | { "method": "externalAgentConfig/import/completed", "params": ExternalAgentConfigImportCompletedNotification } | { "method": "fs/changed", "params": FsChangedNotification } | { "method": "item/reasoning/summaryTextDelta", "params": ReasoningSummaryTextDeltaNotification } | { "method": "item/reasoning/summaryPartAdded", "params": ReasoningSummaryPartAddedNotification } | { "method": "item/reasoning/textDelta", "params": ReasoningTextDeltaNotification } | { "method": "thread/compacted", "params": ContextCompactedNotification } | { "method": "model/rerouted", "params": ModelReroutedNotification } | { "method": "warning", "params": WarningNotification } | { "method": "guardianWarning", "params": GuardianWarningNotification } | { "method": "deprecationNotice", "params": DeprecationNoticeNotification } | { "method": "configWarning", "params": ConfigWarningNotification } | { "method": "fuzzyFileSearch/sessionUpdated", "params": FuzzyFileSearchSessionUpdatedNotification } | { "method": "fuzzyFileSearch/sessionCompleted", "params": FuzzyFileSearchSessionCompletedNotification } | { "method": "thread/realtime/started", "params": ThreadRealtimeStartedNotification } | { "method": "thread/realtime/itemAdded", "params": ThreadRealtimeItemAddedNotification } | { "method": "thread/realtime/transcript/delta", "params": ThreadRealtimeTranscriptDeltaNotification } | { "method": "thread/realtime/transcript/done", "params": ThreadRealtimeTranscriptDoneNotification } | { "method": "thread/realtime/outputAudio/delta", "params": ThreadRealtimeOutputAudioDeltaNotification } | { "method": "thread/realtime/sdp", "params": ThreadRealtimeSdpNotification } | { "method": "thread/realtime/error", "params": ThreadRealtimeErrorNotification } | { "method": "thread/realtime/closed", "params": ThreadRealtimeClosedNotification } | { "method": "windows/worldWritableWarning", "params": WindowsWorldWritableWarningNotification } | { "method": "windowsSandbox/setupCompleted", "params": WindowsSandboxSetupCompletedNotification } | { "method": "account/login/completed", "params": AccountLoginCompletedNotification }; +export type ServerNotification = { "method": "error", "params": ErrorNotification } | { "method": "thread/started", "params": ThreadStartedNotification } | { "method": "thread/status/changed", "params": ThreadStatusChangedNotification } | { "method": "thread/archived", "params": ThreadArchivedNotification } | { "method": "thread/unarchived", "params": ThreadUnarchivedNotification } | { "method": "thread/closed", "params": ThreadClosedNotification } | { "method": "skills/changed", "params": SkillsChangedNotification } | { "method": "thread/name/updated", "params": ThreadNameUpdatedNotification } | { "method": "thread/tokenUsage/updated", "params": ThreadTokenUsageUpdatedNotification } | { "method": "turn/started", "params": TurnStartedNotification } | { "method": "hook/started", "params": HookStartedNotification } | { "method": "turn/completed", "params": TurnCompletedNotification } | { "method": "hook/completed", "params": HookCompletedNotification } | { "method": "turn/diff/updated", "params": TurnDiffUpdatedNotification } | { "method": "turn/plan/updated", "params": TurnPlanUpdatedNotification } | { "method": "item/started", "params": ItemStartedNotification } | { "method": "item/autoApprovalReview/started", "params": ItemGuardianApprovalReviewStartedNotification } | { "method": "item/autoApprovalReview/completed", "params": ItemGuardianApprovalReviewCompletedNotification } | { "method": "item/completed", "params": ItemCompletedNotification } | { "method": "rawResponseItem/completed", "params": RawResponseItemCompletedNotification } | { "method": "item/agentMessage/delta", "params": AgentMessageDeltaNotification } | { "method": "item/plan/delta", "params": PlanDeltaNotification } | { "method": "command/exec/outputDelta", "params": CommandExecOutputDeltaNotification } | { "method": "item/commandExecution/outputDelta", "params": CommandExecutionOutputDeltaNotification } | { "method": "item/commandExecution/terminalInteraction", "params": TerminalInteractionNotification } | { "method": "item/fileChange/outputDelta", "params": FileChangeOutputDeltaNotification } | { "method": "item/fileChange/patchUpdated", "params": FileChangePatchUpdatedNotification } | { "method": "serverRequest/resolved", "params": ServerRequestResolvedNotification } | { "method": "item/mcpToolCall/progress", "params": McpToolCallProgressNotification } | { "method": "mcpServer/oauthLogin/completed", "params": McpServerOauthLoginCompletedNotification } | { "method": "mcpServer/startupStatus/updated", "params": McpServerStatusUpdatedNotification } | { "method": "account/updated", "params": AccountUpdatedNotification } | { "method": "account/rateLimits/updated", "params": AccountRateLimitsUpdatedNotification } | { "method": "app/list/updated", "params": AppListUpdatedNotification } | { "method": "externalAgentConfig/import/completed", "params": ExternalAgentConfigImportCompletedNotification } | { "method": "fs/changed", "params": FsChangedNotification } | { "method": "item/reasoning/summaryTextDelta", "params": ReasoningSummaryTextDeltaNotification } | { "method": "item/reasoning/summaryPartAdded", "params": ReasoningSummaryPartAddedNotification } | { "method": "item/reasoning/textDelta", "params": ReasoningTextDeltaNotification } | { "method": "thread/compacted", "params": ContextCompactedNotification } | { "method": "model/rerouted", "params": ModelReroutedNotification } | { "method": "warning", "params": WarningNotification } | { "method": "guardianWarning", "params": GuardianWarningNotification } | { "method": "deprecationNotice", "params": DeprecationNoticeNotification } | { "method": "configWarning", "params": ConfigWarningNotification } | { "method": "thread/epiphany/stateUpdated", "params": ThreadEpiphanyStateUpdatedNotification } | { "method": "fuzzyFileSearch/sessionUpdated", "params": FuzzyFileSearchSessionUpdatedNotification } | { "method": "fuzzyFileSearch/sessionCompleted", "params": FuzzyFileSearchSessionCompletedNotification } | { "method": "thread/realtime/started", "params": ThreadRealtimeStartedNotification } | { "method": "thread/realtime/itemAdded", "params": ThreadRealtimeItemAddedNotification } | { "method": "thread/realtime/transcript/delta", "params": ThreadRealtimeTranscriptDeltaNotification } | { "method": "thread/realtime/transcript/done", "params": ThreadRealtimeTranscriptDoneNotification } | { "method": "thread/realtime/outputAudio/delta", "params": ThreadRealtimeOutputAudioDeltaNotification } | { "method": "thread/realtime/sdp", "params": ThreadRealtimeSdpNotification } | { "method": "thread/realtime/error", "params": ThreadRealtimeErrorNotification } | { "method": "thread/realtime/closed", "params": ThreadRealtimeClosedNotification } | { "method": "windows/worldWritableWarning", "params": WindowsWorldWritableWarningNotification } | { "method": "windowsSandbox/setupCompleted", "params": WindowsSandboxSetupCompletedNotification } | { "method": "account/login/completed", "params": AccountLoginCompletedNotification }; diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyStateUpdatedNotification.ts b/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyStateUpdatedNotification.ts new file mode 100644 index 00000000..211911c2 --- /dev/null +++ b/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyStateUpdatedNotification.ts @@ -0,0 +1,6 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { EpiphanyThreadState } from "../EpiphanyThreadState"; + +export type ThreadEpiphanyStateUpdatedNotification = { threadId: string, epiphanyState: EpiphanyThreadState, }; diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/index.ts b/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/index.ts index e0f87647..02e1211c 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/index.ts +++ b/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/index.ts @@ -321,6 +321,7 @@ export type { ThreadEpiphanyRetrieveIndexSummary } from "./ThreadEpiphanyRetriev export type { ThreadEpiphanyRetrieveResult } from "./ThreadEpiphanyRetrieveResult"; export type { ThreadEpiphanyRetrieveResultKind } from "./ThreadEpiphanyRetrieveResultKind"; export type { ThreadEpiphanyRetrieveShardSummary } from "./ThreadEpiphanyRetrieveShardSummary"; +export type { ThreadEpiphanyStateUpdatedNotification } from "./ThreadEpiphanyStateUpdatedNotification"; export type { ThreadEpiphanyUpdatePatch } from "./ThreadEpiphanyUpdatePatch"; export type { ThreadForkParams } from "./ThreadForkParams"; export type { ThreadForkResponse } from "./ThreadForkResponse"; diff --git a/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs b/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs index 248e5eda..035abf38 100644 --- a/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs +++ b/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs @@ -1094,6 +1094,8 @@ server_notification_definitions! { GuardianWarning => "guardianWarning" (v2::GuardianWarningNotification), DeprecationNotice => "deprecationNotice" (v2::DeprecationNoticeNotification), ConfigWarning => "configWarning" (v2::ConfigWarningNotification), + #[experimental("thread/epiphany/stateUpdated")] + ThreadEpiphanyStateUpdated => "thread/epiphany/stateUpdated" (v2::ThreadEpiphanyStateUpdatedNotification), FuzzyFileSearchSessionUpdated => "fuzzyFileSearch/sessionUpdated" (FuzzyFileSearchSessionUpdatedNotification), FuzzyFileSearchSessionCompleted => "fuzzyFileSearch/sessionCompleted" (FuzzyFileSearchSessionCompletedNotification), #[experimental("thread/realtime/started")] @@ -1881,6 +1883,34 @@ mod tests { Ok(()) } + #[test] + fn serialize_thread_epiphany_state_updated_notification() -> Result<()> { + let notification = ServerNotification::ThreadEpiphanyStateUpdated( + v2::ThreadEpiphanyStateUpdatedNotification { + thread_id: "thr_123".to_string(), + epiphany_state: codex_protocol::protocol::EpiphanyThreadState { + revision: 7, + objective: Some("Keep the map live".to_string()), + ..Default::default() + }, + }, + ); + assert_eq!( + json!({ + "method": "thread/epiphany/stateUpdated", + "params": { + "threadId": "thr_123", + "epiphanyState": { + "revision": 7, + "objective": "Keep the map live" + } + } + }), + serde_json::to_value(¬ification)?, + ); + Ok(()) + } + #[test] fn serialize_config_requirements_read() -> Result<()> { let request = ClientRequest::ConfigRequirementsRead { @@ -2477,6 +2507,18 @@ mod tests { assert_eq!(reason, Some("thread/epiphany/update")); } + #[test] + fn thread_epiphany_state_updated_notification_is_marked_experimental() { + let notification = ServerNotification::ThreadEpiphanyStateUpdated( + v2::ThreadEpiphanyStateUpdatedNotification { + thread_id: "thr_123".to_string(), + epiphany_state: codex_protocol::protocol::EpiphanyThreadState::default(), + }, + ); + let reason = crate::experimental_api::ExperimentalApi::experimental_reason(¬ification); + assert_eq!(reason, Some("thread/epiphany/stateUpdated")); + } + #[test] fn thread_realtime_start_is_marked_experimental() { let request = ClientRequest::ThreadRealtimeStart { diff --git a/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs b/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs index 53b429c0..de51ebc5 100644 --- a/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs +++ b/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs @@ -4053,6 +4053,14 @@ pub struct ThreadEpiphanyUpdateResponse { pub epiphany_state: CoreEpiphanyThreadState, } +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct ThreadEpiphanyStateUpdatedNotification { + pub thread_id: String, + pub epiphany_state: CoreEpiphanyThreadState, +} + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] #[serde(rename_all = "camelCase")] #[ts(export_to = "v2/")] diff --git a/vendor/codex/codex-rs/app-server/README.md b/vendor/codex/codex-rs/app-server/README.md index 5386a0d6..61e7cd67 100644 --- a/vendor/codex/codex-rs/app-server/README.md +++ b/vendor/codex/codex-rs/app-server/README.md @@ -145,6 +145,7 @@ Experimental Epiphany retrieval: - `thread/epiphany/distill` is a loaded-thread-only read surface that turns one explicit observation input into a deterministic observation/evidence patch plus the current `expectedRevision`. It does not mutate thread state; callers must pass the returned patch to `thread/epiphany/update` to promote it. - `thread/epiphany/promote` is an explicit loaded-thread-only promotion gate. It evaluates a patch plus verifier evidence, rejects with reasons without mutating state when policy fails, and applies the patch through the durable update path when accepted. - `thread/epiphany/update` is the explicit loaded-thread-only control-plane write path for Epiphany state. It can append observations/evidence and replace bounded typed state fields such as objective, subgoals, graph frontier/checkpoint, scratch, churn, and mode; it bumps the Epiphany revision and persists a rollout snapshot immediately. +- `thread/epiphany/stateUpdated` is an experimental server notification emitted after successful `thread/epiphany/update` and accepted `thread/epiphany/promote`. It carries the updated typed `epiphanyState`; rejected promotions do not emit it. The request envelope is camelCase, but nested reused Epiphany core DTOs currently keep their core snake_case fields, such as `source_kind`, `understanding_status`, and `diff_pressure`. - `thread/start` — create a new thread; emits `thread/started` (including the current `thread.status`) and auto-subscribes you to turn/item events for that thread. When the request includes a `cwd` and the resolved sandbox is `workspace-write` or full access, app-server also marks that project as trusted in the user `config.toml`. Pass `sessionStartSource: "clear"` when starting a replacement thread after clearing the current session so `SessionStart` hooks receive `source: "clear"` instead of the default `"startup"`. For permissions, prefer `permissionProfile`; the legacy `sandbox` shorthand is still accepted but cannot be combined with `permissionProfile`. 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 11cf11a0..73c61666 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 @@ -160,6 +160,7 @@ use codex_app_server_protocol::ThreadEpiphanyRetrieveResponse; use codex_app_server_protocol::ThreadEpiphanyRetrieveResult; use codex_app_server_protocol::ThreadEpiphanyRetrieveResultKind; use codex_app_server_protocol::ThreadEpiphanyRetrieveShardSummary; +use codex_app_server_protocol::ThreadEpiphanyStateUpdatedNotification; use codex_app_server_protocol::ThreadEpiphanyUpdateParams; use codex_app_server_protocol::ThreadEpiphanyUpdatePatch; use codex_app_server_protocol::ThreadEpiphanyUpdateResponse; @@ -4390,12 +4391,8 @@ impl CodexMessageProcessor { churn: patch.churn, mode: patch.mode, }; - let response = match thread.epiphany_update_state(update).await { - Ok(epiphany_state) => ThreadEpiphanyPromoteResponse { - accepted: true, - reasons: Vec::new(), - epiphany_state: Some(epiphany_state), - }, + let epiphany_state = match thread.epiphany_update_state(update).await { + Ok(epiphany_state) => epiphany_state, Err(CodexErr::InvalidRequest(message)) => { self.send_invalid_request_error(request_id, message).await; return; @@ -4409,8 +4406,21 @@ impl CodexMessageProcessor { return; } }; + let response = ThreadEpiphanyPromoteResponse { + accepted: true, + reasons: Vec::new(), + epiphany_state: Some(epiphany_state.clone()), + }; self.outgoing.send_response(request_id, response).await; + self.outgoing + .send_server_notification(ServerNotification::ThreadEpiphanyStateUpdated( + ThreadEpiphanyStateUpdatedNotification { + thread_id: thread_uuid.to_string(), + epiphany_state, + }, + )) + .await; } async fn thread_epiphany_update( @@ -4460,8 +4470,8 @@ impl CodexMessageProcessor { churn: patch.churn, mode: patch.mode, }; - let response = match thread.epiphany_update_state(update).await { - Ok(epiphany_state) => ThreadEpiphanyUpdateResponse { epiphany_state }, + let epiphany_state = match thread.epiphany_update_state(update).await { + Ok(epiphany_state) => epiphany_state, Err(CodexErr::InvalidRequest(message)) => { self.send_invalid_request_error(request_id, message).await; return; @@ -4475,8 +4485,19 @@ impl CodexMessageProcessor { return; } }; + let response = ThreadEpiphanyUpdateResponse { + epiphany_state: epiphany_state.clone(), + }; self.outgoing.send_response(request_id, response).await; + self.outgoing + .send_server_notification(ServerNotification::ThreadEpiphanyStateUpdated( + ThreadEpiphanyStateUpdatedNotification { + thread_id: thread_uuid.to_string(), + epiphany_state, + }, + )) + .await; } /// Builds the API view for `thread/read` from persisted metadata plus optional live state.