Expose Epiphany write response metadata
This commit is contained in:
parent
7481787164
commit
4ff1d3ce74
10 changed files with 69 additions and 17 deletions
|
|
@ -21,7 +21,7 @@ The spine exists in eleven 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, typed `source`, event-level `revision`, and typed `changedFields` after successful direct updates and accepted promotions, but not after rejected promotions; accepted promotions always report `Evidence` because verifier evidence is appended even when the patch evidence list is empty, 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:4379), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4464), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:10509), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:10552).
|
||||
- live state notifications and write responses: app-server declares experimental `thread/epiphany/stateUpdated` and emits it with the updated typed state, typed `source`, event-level `revision`, and typed `changedFields` after successful direct updates and accepted promotions, but not after rejected promotions; direct `thread/epiphany/update` and accepted `thread/epiphany/promote` responses now expose the same revision/change metadata, and accepted promotions always report `Evidence` because verifier evidence is appended even when the patch evidence list is empty, 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:3992), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4058), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4069), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4379), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4464), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:10509), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:10552).
|
||||
- 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:
|
||||
|
|
@ -97,7 +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, which revision landed, and which top-level state fields changed.
|
||||
- Successful direct updates and accepted promotions now return and notify clients that typed state changed, which revision landed, and which top-level state fields 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.
|
||||
|
|
@ -129,7 +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, with source, revision, and changed-field labels saying which control-plane door caused it and which ledger sections changed. | The clerk rings the little counter bell only after the ledger ink is dry, and the bell tag says whether this was direct filing or foreman-approved promotion, which page number landed, and which tabs were touched. |
|
||||
| State responses and notifications | Successful direct updates and accepted promotions return the landed revision and changed-field labels to the caller, then publish the updated typed state to app-server clients with source, revision, and changed-field labels saying which control-plane door caused it and which ledger sections changed. | The clerk hands the filing receipt to the person at the counter, then rings the little bell for the room; both say which page number landed and which tabs were touched. |
|
||||
|
||||
## Flow 1: State Shape
|
||||
|
||||
|
|
@ -571,7 +571,7 @@ The app-server handler:
|
|||
2. requires the thread to be loaded.
|
||||
3. maps the app-server patch DTO into `EpiphanyStateUpdate`.
|
||||
4. calls `CodexThread.epiphany_update_state`.
|
||||
5. returns the updated `EpiphanyThreadState`.
|
||||
5. returns the updated `EpiphanyThreadState` plus response-level `revision` and `changedFields`.
|
||||
6. computes `changedFields` from the accepted patch surface.
|
||||
7. emits `thread/epiphany/stateUpdated` with `source: "update"`, event-level `revision`, typed `changedFields`, and the same updated state.
|
||||
8. reports empty patches and revision mismatches as invalid requests before notification.
|
||||
|
|
@ -601,7 +601,7 @@ Code refs:
|
|||
|
||||
### Output
|
||||
|
||||
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 `source: "update"`, event-level `revision`, typed `changedFields`, and the same updated state to app-server clients.
|
||||
The response contains the updated `epiphanyState`, response-level `revision`, and response-level `changedFields`. The durable side effect is a rollout `EpiphanyState` snapshot. The live side effect is a `thread/epiphany/stateUpdated` notification carrying `source: "update"`, event-level `revision`, typed `changedFields`, and the same updated state to app-server clients.
|
||||
|
||||
### Invariant
|
||||
|
||||
|
|
@ -827,7 +827,7 @@ The app-server handler:
|
|||
5. appends verifier evidence to the patch evidence when policy accepts.
|
||||
6. maps the patch into `EpiphanyStateUpdate`.
|
||||
7. calls `CodexThread.epiphany_update_state`.
|
||||
8. returns the updated `EpiphanyThreadState`.
|
||||
8. returns the updated `EpiphanyThreadState` plus response-level `revision` and `changedFields`.
|
||||
9. emits `thread/epiphany/stateUpdated` with `source: "promote"`, event-level `revision`, and typed `changedFields` only for the accepted path; `Evidence` is included even if the accepted patch had no patch evidence because verifier evidence was appended to the durable state.
|
||||
|
||||
`evaluate_promotion` currently enforces a deliberately small but now delta-aware policy:
|
||||
|
|
@ -856,7 +856,7 @@ Code refs:
|
|||
|
||||
### Output
|
||||
|
||||
Rejected promotions return reasons and no state. Accepted promotions return the updated `epiphanyState` from the durable update path and emit `thread/epiphany/stateUpdated` with `source: "promote"`, event-level `revision`, typed `changedFields`, plus that state. Because accepted promotion always appends verifier evidence, promotion notifications report `Evidence` even when the submitted patch evidence array was empty.
|
||||
Rejected promotions return reasons and no state. Accepted promotions return the updated `epiphanyState`, response-level `revision`, and response-level `changedFields` from the durable update path, then emit `thread/epiphany/stateUpdated` with `source: "promote"`, event-level `revision`, typed `changedFields`, plus that state. Because accepted promotion always appends verifier evidence, promotion responses and notifications report `Evidence` even when the submitted patch evidence array was empty.
|
||||
|
||||
### Invariant
|
||||
|
||||
|
|
@ -921,7 +921,7 @@ Current tests cover the landed flows at useful seams:
|
|||
- 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`, `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`, including update/promote `thread/epiphany/stateUpdated` notifications with source, revision, changed-field checks, and the verifier-only promotion edge where `Evidence` changes because verifier evidence is appended.
|
||||
- reusable app-server smoke for the richer Phase 5 chain in `tools/epiphany_phase5_smoke.py`, including update/promote response metadata, `thread/epiphany/stateUpdated` notifications with source, revision, changed-field checks, and the verifier-only promotion edge where `Evidence` changes because verifier evidence is appended.
|
||||
|
||||
Useful commands:
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ This note tracks Epiphany as a fork of Codex with an opinionated modeling archit
|
|||
- 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, verifier-only promotion notification evidence changes, risky-delta rejection, expanded-low-pressure rejection, substring verifier-kind rejection, and accepted graph/churn promotion through the loaded-thread seam
|
||||
- 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`, typed `source`, event-level `revision`, and typed `changedFields` while rejected promotions remain silent and non-mutating; accepted promotions always report `evidence` when verifier evidence is appended
|
||||
- a direct write-response hardening slice: successful `thread/epiphany/update` and accepted `thread/epiphany/promote` responses now include response-level `revision` and `changedFields`, matching the notification metadata without forcing the initiating caller to wait for or diff the live event
|
||||
- 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, prove that richer chain over app-server by hand, add the first live state notification after successful writes, or make that notification say which revision and state sections changed. 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.
|
||||
|
|
@ -245,7 +246,9 @@ Current bounded shape of that follow-up:
|
|||
- it carries typed `changedFields` derived from the accepted patch surface so clients can react to top-level state-section changes without diffing the entire `epiphanyState`
|
||||
- accepted promotion notifications include `evidence` even when the patch evidence list was empty, because verifier evidence is appended to durable state after policy acceptance
|
||||
- it does not fire for rejected promotions, because rejection still does not mutate state
|
||||
- the richer app-server smoke now asserts direct update publishes source/revision/changed-fields `update`/`1`/`observations,evidence`, verifier-only accepted promotion publishes `promote`/`2`/`observations,evidence`, and accepted graph/churn promotion publishes `promote`/`3`/`graphs,graphFrontier,observations,evidence,churn`
|
||||
- successful `thread/epiphany/update` responses now also carry response-level `revision` and `changedFields`
|
||||
- accepted `thread/epiphany/promote` responses now also carry response-level `revision` and `changedFields`; rejected promotion responses omit revision/change metadata and still carry reasons plus no state
|
||||
- the richer app-server smoke now asserts direct update responses/notifications publish revision/changed-fields `1`/`observations,evidence`, verifier-only accepted promotion responses/notifications publish `2`/`observations,evidence`, and accepted graph/churn promotion responses/notifications publish `3`/`graphs,graphFrontier,observations,evidence,churn`
|
||||
|
||||
Follow-up addition now landed after the update surface:
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ Recent anchor commits:
|
|||
- `4c770e9` - labeled Epiphany state update notifications with typed `source` values
|
||||
- latest slice - hardened `thread/epiphany/stateUpdated` with event-level `revision` and typed `changedFields`
|
||||
- current slice - fixed accepted promotion notifications so `changedFields` always includes `evidence` when verifier evidence is appended, even if the accepted patch had no patch evidence
|
||||
- current slice - added response-level `revision` and `changedFields` to successful `thread/epiphany/update` and accepted `thread/epiphany/promote` responses
|
||||
|
||||
Do not trust this note for the exact current HEAD; use `git log --oneline -1` if you need the live commit.
|
||||
|
||||
|
|
@ -90,13 +91,14 @@ Current verified typed state/promotion layer:
|
|||
- 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, with typed `source` values of `update` or `promote`, event-level `revision`, and typed `changedFields`
|
||||
- response-level `revision` and `changedFields` on successful `thread/epiphany/update` and accepted `thread/epiphany/promote`
|
||||
- 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; notifications identify their `source`, expose event-level `revision`, list typed `changedFields`, and rejected promotions still do not mutate state or emit an update notification
|
||||
- app-server now returns response-level `revision` and `changedFields` from successful direct update and accepted promotion calls, and emits `thread/epiphany/stateUpdated` after the direct update path and after accepted promotion return an updated state; notifications identify their `source`, expose event-level `revision`, list typed `changedFields`, and 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
|
||||
|
||||
|
|
@ -205,7 +207,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`, event-level `revision`, typed `changedFields`, plus `source: "update"` or `source: "promote"`
|
||||
- `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`, event-level `revision`, typed `changedFields`, plus `source: "update"` or `source: "promote"`; the direct update/promote responses also return `revision` and `changedFields`
|
||||
- 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:
|
||||
|
|
@ -362,7 +364,7 @@ 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, including source labels, event-level revision, and typed changed fields
|
||||
- experimental `thread/epiphany/stateUpdated` now exists and is live-smoked for both direct update and accepted promote paths, including source labels, event-level revision, and typed changed fields; successful update/promote responses now mirror revision and changed fields too
|
||||
- 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
|
||||
|
|
@ -519,4 +521,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`. Successful direct updates and accepted promotions now emit experimental `thread/epiphany/stateUpdated` notifications carrying the updated typed state, source labels, event-level revision, and typed changed fields; accepted promotion notifications include `evidence` whenever verifier evidence is appended, even when patch evidence was empty. 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 source/revision/changed-fields `update`/1/`observations,evidence`, verifier-only accepted promotion changed-fields `promote`/2/`observations,evidence`, expanded-low-pressure and substring-verifier rejection checks, accepted graph/churn promotion, and promote notification source/revision/changed-fields `promote`/3/`graphs,graphFrontier,observations,evidence,churn`. 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.
|
||||
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 return response-level revision/changed-field metadata and emit experimental `thread/epiphany/stateUpdated` notifications carrying the updated typed state, source labels, event-level revision, and typed changed fields; accepted promotion responses/notifications include `evidence` whenever verifier evidence is appended, even when patch evidence was empty. 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 response/notification revision/changed-fields `1`/`observations,evidence`, verifier-only accepted promotion response/notification changed-fields `2`/`observations,evidence`, expanded-low-pressure and substring-verifier rejection checks, accepted graph/churn promotion, and promote response/notification revision/changed-fields `3`/`graphs,graphFrontier,observations,evidence,churn`. 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.
|
||||
|
|
|
|||
|
|
@ -142,3 +142,5 @@
|
|||
{"ts": "2026-04-25T06:32:14+00:00", "type": "verification", "status": "ok", "note": "Verified Compact-Rehydrate-Reorient-Continue continuity after revisioned changed-field stateUpdated notifications. Branch main was clean/synced at 366354d before this evidence record; state/map.yaml, fresh-workspace-handoff, implementation plan, Epiphany algorithmic map, evidence tail, and git log all agree that thread/epiphany/stateUpdated now emits source, event-level revision, and typed changedFields for successful update/promote writes. Next action remains the next bounded live typed-state/read-surface hardening slice; keep retrieval/distill/propose read-only and avoid GUI, watcher, or specialist-agent machinery."}
|
||||
{"ts": "2026-04-25T07:27:00+00:00", "type": "implementation", "status": "ok", "note": "Hardened accepted promotion notifications so changedFields includes evidence whenever verifier evidence is appended, even if patch evidence was empty; extended Phase 5 smoke with verifier-only promotion edge."}
|
||||
{"ts": "2026-04-25T07:27:24+00:00", "type": "verification", "status": "ok", "note": "Verified accepted-promotion notification evidence hardening with py_compile tools/epiphany_phase5_smoke.py, cargo fmt -p codex-app-server, cargo test -p codex-app-server --lib epiphany_promote_changed_fields_reports_appended_verifier_evidence, cargo test -p codex-app-server --lib map_epiphany_, detached codex-app-server rebuild exit 0, tools/epiphany_phase5_smoke.py. Smoke observed verifier-only promote changedFields observations/evidence at revision 2 and graph/churn promote changedFields graphs/graphFrontier/observations/evidence/churn at revision 3."}
|
||||
{"ts": "2026-04-25T07:59:08+00:00", "type": "implementation", "status": "ok", "note": "Added response-level revision and changedFields to successful thread/epiphany/update and accepted thread/epiphany/promote responses, matching stateUpdated notification metadata for initiating callers; updated Phase 5 smoke and docs/state."}
|
||||
{"ts": "2026-04-25T07:59:14+00:00", "type": "verification", "status": "ok", "note": "Verified direct write-response metadata hardening with py_compile tools/epiphany_phase5_smoke.py, cargo fmt -p codex-app-server-protocol -p codex-app-server, cargo test -p codex-app-server-protocol --lib thread_epiphany, cargo test -p codex-app-server --lib epiphany_promote_changed_fields_reports_appended_verifier_evidence, cargo test -p codex-app-server --lib map_epiphany_, cargo run -p codex-app-server-protocol --bin write_schema_fixtures, full cargo test -p codex-app-server-protocol, detached app-server rebuild exit 0, and tools/epiphany_phase5_smoke.py. Smoke observed matching response/notification revisions and changedFields for update, verifier-only promote, and graph/churn promote."}
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ accepted_design:
|
|||
- 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
|
||||
- harden 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`, includes a typed `source` of `update` or `promote`, event-level `revision`, and typed `changedFields`, while rejected promotions still do not mutate state or emit update notifications
|
||||
- harden accepted-promotion notification accuracy: because accepted `thread/epiphany/promote` always appends verifier evidence to durable state, promotion notifications must include `evidence` in `changedFields` even when the submitted patch evidence list was empty
|
||||
- harden direct write responses: successful `thread/epiphany/update` and accepted `thread/epiphany/promote` responses now include response-level `revision` and `changedFields`, matching the live notification metadata for initiating callers
|
||||
|
||||
rejected_paths:
|
||||
- name: pinned_map_only
|
||||
|
|
@ -126,5 +127,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 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 with typed `source` values of `update` or `promote`, event-level `revision`, typed `changedFields`, 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. Promotion notifications now include `evidence` in `changedFields` whenever accepted promotion appends verifier evidence, even if the patch evidence list was empty. The richer smoke now verifies source-output distillation, read-only proposal, update notification source/revision/changed-fields `update`/1/`observations,evidence`, verifier-only accepted promotion notification `promote`/2/`observations,evidence`, risky-delta rejection, expanded-low-pressure rejection, weak-verifier rejection, substring-verifier rejection, accepted graph/churn promotion, and graph/churn promote notification source/revision/changed-fields `promote`/3/`graphs,graphFrontier,observations,evidence,churn` 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.
|
||||
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`, response-level `revision` and `changedFields` on successful direct updates and accepted promotions, experimental `thread/epiphany/stateUpdated` notifications after successful direct updates and accepted promotions with typed `source` values of `update` or `promote`, event-level `revision`, typed `changedFields`, 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. Promotion responses and notifications now include `evidence` in `changedFields` whenever accepted promotion appends verifier evidence, even if the patch evidence list was empty. The richer smoke now verifies source-output distillation, read-only proposal, update response/notification revision/changed-fields `1`/`observations,evidence`, verifier-only accepted promotion response/notification `2`/`observations,evidence`, risky-delta rejection, expanded-low-pressure rejection, weak-verifier rejection, substring-verifier rejection, accepted graph/churn promotion, and graph/churn promote response/notification revision/changed-fields `3`/`graphs,graphFrontier,observations,evidence,churn` 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.
|
||||
|
|
|
|||
|
|
@ -280,6 +280,11 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]:
|
|||
)
|
||||
assert update is not None
|
||||
require(update["epiphanyState"]["revision"] == 1, "update should advance revision to 1")
|
||||
require(update["revision"] == 1, "update response should expose revision 1")
|
||||
require(
|
||||
update["changedFields"] == ["observations", "evidence"],
|
||||
"update response should expose changed fields",
|
||||
)
|
||||
update_notification = client.wait_for_notification(
|
||||
"thread/epiphany/stateUpdated",
|
||||
start_index=update_notification_start,
|
||||
|
|
@ -339,6 +344,14 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]:
|
|||
verifier_only_promote["epiphanyState"]["revision"] == 2,
|
||||
"verifier-only promotion should advance revision to 2",
|
||||
)
|
||||
require(
|
||||
verifier_only_promote["revision"] == 2,
|
||||
"verifier-only promote response should expose revision 2",
|
||||
)
|
||||
require(
|
||||
verifier_only_promote["changedFields"] == ["observations", "evidence"],
|
||||
"verifier-only promote response should expose changed fields",
|
||||
)
|
||||
verifier_only_notification = client.wait_for_notification(
|
||||
"thread/epiphany/stateUpdated",
|
||||
start_index=verifier_only_notification_start,
|
||||
|
|
@ -517,6 +530,12 @@ 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"] == 3, "accepted promotion should advance revision to 3")
|
||||
require(accepted["revision"] == 3, "accepted promote response should expose revision 3")
|
||||
require(
|
||||
accepted["changedFields"]
|
||||
== ["graphs", "graphFrontier", "observations", "evidence", "churn"],
|
||||
"accepted promote response should expose changed fields",
|
||||
)
|
||||
promote_notification = client.wait_for_notification(
|
||||
"thread/epiphany/stateUpdated",
|
||||
start_index=promote_notification_start,
|
||||
|
|
@ -563,8 +582,12 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]:
|
|||
"distillEvidenceKind": evidence["kind"],
|
||||
"distillSummary": evidence["summary"],
|
||||
"updateNotificationSource": update_notification["params"]["source"],
|
||||
"updateResponseRevision": update["revision"],
|
||||
"updateResponseChangedFields": update["changedFields"],
|
||||
"updateNotificationRevision": update_notification["params"]["revision"],
|
||||
"updateNotificationChangedFields": update_notification["params"]["changedFields"],
|
||||
"verifierOnlyPromoteResponseRevision": verifier_only_promote["revision"],
|
||||
"verifierOnlyPromoteResponseChangedFields": verifier_only_promote["changedFields"],
|
||||
"verifierOnlyPromoteRevision": verifier_only_notification["params"]["revision"],
|
||||
"verifierOnlyPromoteChangedFields": verifier_only_notification["params"][
|
||||
"changedFields"
|
||||
|
|
@ -583,6 +606,8 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]:
|
|||
"substringVerifierReasons": reject_substring_verifier["reasons"],
|
||||
"accepted": accepted["accepted"],
|
||||
"finalRevision": final_state["revision"],
|
||||
"promoteResponseRevision": accepted["revision"],
|
||||
"promoteResponseChangedFields": accepted["changedFields"],
|
||||
"promoteNotificationSource": promote_notification["params"]["source"],
|
||||
"promoteNotificationRevision": promote_notification["params"]["revision"],
|
||||
"promoteNotificationChangedFields": promote_notification["params"][
|
||||
|
|
|
|||
|
|
@ -1831,6 +1831,8 @@ mod tests {
|
|||
response: v2::ThreadEpiphanyPromoteResponse {
|
||||
accepted: false,
|
||||
reasons: vec!["verifierEvidence.status must be accepting".to_string()],
|
||||
revision: None,
|
||||
changed_fields: Vec::new(),
|
||||
epiphany_state: None,
|
||||
},
|
||||
};
|
||||
|
|
@ -1857,6 +1859,8 @@ mod tests {
|
|||
let response = ClientResponse::ThreadEpiphanyUpdate {
|
||||
request_id: RequestId::Integer(12),
|
||||
response: v2::ThreadEpiphanyUpdateResponse {
|
||||
revision: 2,
|
||||
changed_fields: vec![v2::ThreadEpiphanyStateUpdatedField::Objective],
|
||||
epiphany_state: codex_protocol::protocol::EpiphanyThreadState {
|
||||
revision: 2,
|
||||
objective: Some("Keep the map honest".to_string()),
|
||||
|
|
@ -1872,6 +1876,8 @@ mod tests {
|
|||
"method": "thread/epiphany/update",
|
||||
"id": 12,
|
||||
"response": {
|
||||
"revision": 2,
|
||||
"changedFields": ["objective"],
|
||||
"epiphanyState": {
|
||||
"revision": 2,
|
||||
"objective": "Keep the map honest"
|
||||
|
|
|
|||
|
|
@ -3992,6 +3992,11 @@ pub struct ThreadEpiphanyPromoteParams {
|
|||
pub struct ThreadEpiphanyPromoteResponse {
|
||||
pub accepted: bool,
|
||||
pub reasons: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub revision: Option<u64>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub changed_fields: Vec<ThreadEpiphanyStateUpdatedField>,
|
||||
pub epiphany_state: Option<CoreEpiphanyThreadState>,
|
||||
}
|
||||
|
||||
|
|
@ -4050,6 +4055,8 @@ pub struct ThreadEpiphanyUpdatePatch {
|
|||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadEpiphanyUpdateResponse {
|
||||
pub revision: u64,
|
||||
pub changed_fields: Vec<ThreadEpiphanyStateUpdatedField>,
|
||||
pub epiphany_state: CoreEpiphanyThreadState,
|
||||
}
|
||||
|
||||
|
|
|
|||
6
vendor/codex/codex-rs/app-server/README.md
vendored
6
vendor/codex/codex-rs/app-server/README.md
vendored
|
|
@ -143,9 +143,9 @@ Experimental Epiphany retrieval:
|
|||
- `thread/epiphany/index` runs an explicit loaded-thread-only semantic indexing pass that writes a Qdrant-backed workspace index under Codex home metadata, using local Ollama embeddings by default. It is the write path for persistent semantic retrieval and keeps `thread/epiphany/retrieve` read-only.
|
||||
- `thread/epiphany/retrieve` runs a loaded-thread-only hybrid repo query that combines `codex_file_search` path hits with BM25 chunk retrieval and returns typed result metadata plus an Epiphany retrieval summary.
|
||||
- `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` plus a `source` of `update` or `promote`; rejected promotions do not emit 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. Accepted responses include the landed `revision` and `changedFields`.
|
||||
- `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, returns `revision` plus `changedFields`, 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`, a `source` of `update` or `promote`, event-level `revision`, and typed `changedFields`; 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`.
|
||||
|
|
|
|||
|
|
@ -4369,6 +4369,8 @@ impl CodexMessageProcessor {
|
|||
ThreadEpiphanyPromoteResponse {
|
||||
accepted: false,
|
||||
reasons: decision.reasons,
|
||||
revision: None,
|
||||
changed_fields: Vec::new(),
|
||||
epiphany_state: None,
|
||||
},
|
||||
)
|
||||
|
|
@ -4412,6 +4414,8 @@ impl CodexMessageProcessor {
|
|||
let response = ThreadEpiphanyPromoteResponse {
|
||||
accepted: true,
|
||||
reasons: Vec::new(),
|
||||
revision: Some(epiphany_state.revision),
|
||||
changed_fields: changed_fields.clone(),
|
||||
epiphany_state: Some(epiphany_state.clone()),
|
||||
};
|
||||
|
||||
|
|
@ -4493,6 +4497,8 @@ impl CodexMessageProcessor {
|
|||
}
|
||||
};
|
||||
let response = ThreadEpiphanyUpdateResponse {
|
||||
revision: epiphany_state.revision,
|
||||
changed_fields: changed_fields.clone(),
|
||||
epiphany_state: epiphany_state.clone(),
|
||||
};
|
||||
|
||||
|
|
|
|||
Reference in a new issue