Add review-gated modeling graph acceptance
This commit is contained in:
parent
c41f1c6a8a
commit
a7bfffba51
16 changed files with 737 additions and 21 deletions
|
|
@ -69,6 +69,7 @@ fn run_operator_action(
|
|||
"coordinatorPlan" => run_coordinator_plan(&repo_root, request),
|
||||
"launchModeling"
|
||||
| "readModelingResult"
|
||||
| "acceptModeling"
|
||||
| "launchVerification"
|
||||
| "readVerificationResult"
|
||||
| "launchReorient"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ const actionButtons: Array<{
|
|||
title: string;
|
||||
requiresThread?: boolean;
|
||||
requiresReadyState?: boolean;
|
||||
requiresModelingPatch?: boolean;
|
||||
requiresReorientResult?: boolean;
|
||||
icon: "file" | "check" | "play" | "eye" | "accept";
|
||||
}> = [
|
||||
|
|
@ -63,6 +64,16 @@ const actionButtons: Array<{
|
|||
requiresThread: true,
|
||||
icon: "eye",
|
||||
},
|
||||
{
|
||||
action: "acceptModeling",
|
||||
label: "Accept Modeling",
|
||||
runningLabel: "Accepting",
|
||||
title: "Accept a reviewed modeling graph/checkpoint patch into Epiphany state",
|
||||
requiresThread: true,
|
||||
requiresReadyState: true,
|
||||
requiresModelingPatch: true,
|
||||
icon: "accept",
|
||||
},
|
||||
{
|
||||
action: "launchVerification",
|
||||
label: "Launch Verification",
|
||||
|
|
@ -210,6 +221,9 @@ export function App() {
|
|||
const reorientResult = status?.reorientResult ?? {};
|
||||
const readyState = scene.stateStatus === "ready";
|
||||
const currentThreadId = request.threadId;
|
||||
const modelingFinding = roleResults?.modeling?.finding;
|
||||
const canAcceptModeling =
|
||||
text(roleResults?.modeling?.status).toLowerCase() === "completed" && Boolean(modelingFinding?.statePatch);
|
||||
const canAcceptReorient = text(reorientResult?.status).toLowerCase() === "completed";
|
||||
|
||||
return (
|
||||
|
|
@ -248,15 +262,18 @@ export function App() {
|
|||
{actionButtons.map((button) => {
|
||||
const needsThread = button.requiresThread && !currentThreadId;
|
||||
const needsState = button.requiresReadyState && !readyState;
|
||||
const needsModeling = button.requiresModelingPatch && !canAcceptModeling;
|
||||
const needsReorient = button.requiresReorientResult && !canAcceptReorient;
|
||||
const disabled = runningAction !== null || needsThread || needsState || needsReorient;
|
||||
const disabled = runningAction !== null || needsThread || needsState || needsModeling || needsReorient;
|
||||
const title = needsThread
|
||||
? "Prepare a checkpoint or enter a persisted thread id first"
|
||||
: needsState
|
||||
? "Prepare Epiphany state before launching this lane"
|
||||
: needsReorient
|
||||
? "Read a completed reorient result before accepting it"
|
||||
: button.title;
|
||||
: needsModeling
|
||||
? "Read a completed modeling result with a state patch before accepting it"
|
||||
: needsReorient
|
||||
? "Read a completed reorient result before accepting it"
|
||||
: button.title;
|
||||
return (
|
||||
<button
|
||||
className="secondaryButton"
|
||||
|
|
@ -418,6 +435,7 @@ function Finding({ title, result, findingKey = "finding" }: { title: string; res
|
|||
<dl className="facts compact">
|
||||
<div><dt>Verdict</dt><dd>{text(finding.verdict ?? finding.mode)}</dd></div>
|
||||
<div><dt>Next</dt><dd>{text(finding.nextSafeMove)}</dd></div>
|
||||
<div><dt>Patch</dt><dd>{finding.statePatch ? "available" : "none"}</dd></div>
|
||||
</dl>
|
||||
</>
|
||||
) : (
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export type OperatorAction =
|
|||
| "prepareCheckpoint"
|
||||
| "launchModeling"
|
||||
| "readModelingResult"
|
||||
| "acceptModeling"
|
||||
| "launchVerification"
|
||||
| "readVerificationResult"
|
||||
| "launchReorient"
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ The spine exists in twenty-five live paths:
|
|||
- reorientation policy: app-server declares experimental read-only `thread/epiphany/reorient`, reuses the same live/stored thread view plus mapped pressure/freshness/watcher signals, and derives a bounded `resume`/`regather` verdict with checkpoint-path/frontier reasons without mutating, compacting, scheduling, notifying, or continuing work in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:365), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4514), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4394), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:11424).
|
||||
- CRRC coordinator recommendation: app-server declares experimental read-only `thread/epiphany/crrc`, reuses the same pressure/freshness/watcher/reorientation mapping plus the fixed `reorient-worker` binding and result read-back helper, recognizes already accepted reorientation findings so an accepted result is not recommended for acceptance again, and returns one bounded recommendation such as continue, prepare checkpoint, launch worker, wait, review, accept, or regather manually without mutating, launching, accepting, compacting, notifying, scheduling, or silently continuing work in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:370), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4661), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4546).
|
||||
- role ownership projection: app-server declares experimental read-only `thread/epiphany/roles`, reuses the same state/jobs/pressure/reorient/result/CRRC signals as the coordinator loop, and projects implementation, modeling/checkpoint, verification/review, and reorientation lanes with owner roles, status, linked jobs, authority scopes, and recommended scene actions without launching, scheduling, accepting, compacting, notifying, or mutating state in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:350), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4161), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4310).
|
||||
- role specialist launch/read-back: app-server declares experimental `thread/epiphany/roleLaunch` and read-only `thread/epiphany/roleResult`. `roleLaunch` accepts only fixed modeling/checkpoint and verification/review role ids, builds bounded specialist payloads from authoritative Epiphany state, routes them through the existing `epiphany_launch_job` job-control seam, and emits the normal `jobLaunch` state update for `jobBindings` only. `roleResult` resolves the fixed or requested binding through the current `agent_jobs` backend and projects structured output as a reviewable finding with verdict, summary, next safe move, inspected files, frontier/evidence ids, raw result, and errors without mutation, promotion, scheduling, or hidden continuation. Implementation stays owned by the main coding agent, and reorientation stays on the CRRC-specific `reorientLaunch` / `reorientResult` path.
|
||||
- role specialist launch/read-back/acceptance: app-server declares experimental `thread/epiphany/roleLaunch`, read-only `thread/epiphany/roleResult`, and write-gated `thread/epiphany/roleAccept`. `roleLaunch` accepts only fixed modeling/checkpoint and verification/review role ids, builds bounded specialist payloads from authoritative Epiphany state, routes them through the existing `epiphany_launch_job` job-control seam, and emits the normal `jobLaunch` state update for `jobBindings` only. `roleResult` resolves the fixed or requested binding through the current `agent_jobs` backend and projects structured output as a reviewable finding with verdict, summary, next safe move, inspected files, frontier/evidence ids, optional modeling `statePatch`, raw result, and errors without mutation, promotion, scheduling, or hidden continuation. `roleAccept` currently accepts only completed modeling/checkpoint findings with a valid modeling-safe `statePatch`, applies it through the existing Epiphany state validator, appends audit observation/evidence, and emits `stateUpdated` with source `roleAccept`. Implementation stays owned by the main coding agent, verification output remains review-only, and reorientation stays on the CRRC-specific `reorientLaunch` / `reorientResult` / `reorientAccept` path.
|
||||
- MVP operator view: `tools/epiphany_mvp_status.py` launches app-server over stdio, starts or reads one thread, gathers scene, pressure, reorient, jobs, roles, modeling/verification role results, reorient result, and CRRC responses, and renders them as text or JSON so the loop can be dogfooded without reading Rust.
|
||||
- MVP dogfood runner: `tools/epiphany_mvp_dogfood.py` launches app-server over stdio, drives a bounded state/role/CRRC/reorientation loop, and writes local JSON/text/transcript artifacts under `.epiphany-dogfood/mvp-loop` so a human can audit the run and compare it against a vanilla Codex reference.
|
||||
- reorientation launch: app-server now declares experimental `thread/epiphany/reorientLaunch`, requires a loaded thread plus durable investigation checkpoint, consumes the live reorientation verdict, and launches one fixed `reorient-worker` binding through the existing job-control seam with explicit resume-versus-regather scope, checkpoint-derived payload, and structured-output expectations instead of pretending CRRC suddenly grew a scheduler in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:370), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4575), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4519).
|
||||
|
|
@ -1445,6 +1445,7 @@ stored Epiphany state
|
|||
-> reflected as read-only MVP role ownership over implementation, modeling/checkpoint, verification/review, and reorientation lanes
|
||||
-> fixed modeling/checkpoint and verification/review role workers can be launched explicitly
|
||||
-> fixed role worker results can be read back for review without mutation
|
||||
-> reviewed modeling/checkpoint statePatch findings can be accepted explicitly to grow graph/checkpoint state
|
||||
-> can be consumed explicitly by one bounded reorient-worker launch surface
|
||||
-> retrieval/indexing can inform future work
|
||||
-> explicit distillation can draft observation/evidence patches
|
||||
|
|
@ -1454,7 +1455,7 @@ stored Epiphany state
|
|||
-> successful writes emit thread/epiphany/stateUpdated
|
||||
```
|
||||
|
||||
The current remaining missing organ is not the red pen, not the first chewing motion, not the first state-change bell, not the first client-shaped scene, not the first job/progress reflection, not the first live bound-job notification, not the first freshness lens, not the first watcher-backed invalidation read, not the first targeted graph/evidence context read, not the first bounded graph traversal read, not the first context-pressure gauge, not the first durable investigation checkpoint packet, not the first bounded reorientation verdict, not the first thin launcher seam, not the first explicit launch/interrupt authority surface over that seam, not the first runtime consumer that can act on the reorientation verdict without becoming a hidden tyrant, not the first read-back surface for that worker's findings, not the first explicit acceptance write for completed findings, not the first read-only CRRC coordinator recommendation, not the first role ownership board, not the first fixed role specialist launch/read-back templates, and no longer the first dogfood-facing operator view over the landed loop. 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, token-matches strong verifier kinds so `contest` cannot sneak past as `test`, and validates investigation checkpoints against known evidence before the packet can be inked. Successful update/promote writes now emit `thread/epiphany/stateUpdated` with `source: "update"` or `source: "promote"`, event-level revision, and typed changed fields so clients no longer need to poll blindly, infer the cause from timing, or diff the whole state to know which top-level sections moved. Runtime `agent_job_progress` background events now also emit `thread/epiphany/jobsUpdated` with changed bound-job payloads so clients no longer need to poll `thread/epiphany/jobs` just to watch one real owner move, the bound jobs now reflect launcher id, authority scope, and backend kind/job id instead of treating raw runtime pointers as the architecture, `jobLaunch` / `jobInterrupt` can create or tear down those bindings without pretending reflection is authority, `reorientLaunch` can launch one fixed `reorient-worker` job from the checkpoint verdict without turning the verdict itself into a writer, `reorientResult` can read the worker's structured output back as a reviewable finding without promoting it, `reorientAccept` can explicitly bank a completed finding into typed observation/evidence plus optional scratch/checkpoint state, `roleLaunch` can launch fixed modeling/checkpoint and verification/review specialists over that same bounded seam, `roleResult` can read their structured outputs back without mutation, and `crrc` can recommend the next explicit action over that loop without doing the action itself. The scene, jobs, roles, role-result, freshness, context, graphQuery, pressure, reorient, crrc, reorient-result, and MVP status surfaces give clients compact or bounded views without making the GUI/client authoritative. The remaining missing organs are a second backend if `agent_jobs` stops being enough, automatic scheduling if dogfood proves it is needed, and richer product ergonomics after the MVP loop has been tested by a human.
|
||||
The current remaining missing organ is not the red pen, not the first chewing motion, not the first state-change bell, not the first client-shaped scene, not the first job/progress reflection, not the first live bound-job notification, not the first freshness lens, not the first watcher-backed invalidation read, not the first targeted graph/evidence context read, not the first bounded graph traversal read, not the first context-pressure gauge, not the first durable investigation checkpoint packet, not the first bounded reorientation verdict, not the first thin launcher seam, not the first explicit launch/interrupt authority surface over that seam, not the first runtime consumer that can act on the reorientation verdict without becoming a hidden tyrant, not the first read-back surface for that worker's findings, not the first explicit acceptance write for completed findings, not the first read-only CRRC coordinator recommendation, not the first role ownership board, not the first fixed role specialist launch/read-back templates, not the first review-gated modeling statePatch acceptance path, and no longer the first dogfood-facing operator view over the landed loop. 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, token-matches strong verifier kinds so `contest` cannot sneak past as `test`, and validates investigation checkpoints against known evidence before the packet can be inked. Successful update/promote writes now emit `thread/epiphany/stateUpdated` with `source: "update"` or `source: "promote"`, event-level revision, and typed changed fields so clients no longer need to poll blindly, infer the cause from timing, or diff the whole state to know which top-level sections moved. Runtime `agent_job_progress` background events now also emit `thread/epiphany/jobsUpdated` with changed bound-job payloads so clients no longer need to poll `thread/epiphany/jobs` just to watch one real owner move, the bound jobs now reflect launcher id, authority scope, and backend kind/job id instead of treating raw runtime pointers as the architecture, `jobLaunch` / `jobInterrupt` can create or tear down those bindings without pretending reflection is authority, `reorientLaunch` can launch one fixed `reorient-worker` job from the checkpoint verdict without turning the verdict itself into a writer, `reorientResult` can read the worker's structured output back as a reviewable finding without promoting it, `reorientAccept` can explicitly bank a completed finding into typed observation/evidence plus optional scratch/checkpoint state, `roleLaunch` can launch fixed modeling/checkpoint and verification/review specialists over that same bounded seam, `roleResult` can read their structured outputs back without mutation, `roleAccept` can apply a reviewed modeling graph/checkpoint patch through the normal state validator, and `crrc` can recommend the next explicit action over that loop without doing the action itself. The scene, jobs, roles, role-result, role-accept, freshness, context, graphQuery, pressure, reorient, crrc, reorient-result, and MVP status surfaces give clients compact or bounded views without making the GUI/client authoritative. The remaining missing organs are a second backend if `agent_jobs` stops being enough, automatic scheduling if dogfood proves it is needed, and richer product ergonomics after the MVP loop has been tested by a human.
|
||||
|
||||
```text
|
||||
model/tool observations
|
||||
|
|
@ -1470,7 +1471,7 @@ The typed write path exists, the first deterministic observation/evidence distil
|
|||
|
||||
In natural language: current Epiphany can preserve a map, show a map, project a compact scene from the map, project derived job/progress slots from the map and retrieval summary, reflect a thin launcher seam over bound work, explicitly launch or interrupt that bound work through a bounded authority surface, emit live bound-job progress notifications from runtime `agent_job_progress` events, project a read-only freshness lens over retrieval and graph staleness, layer watcher-backed invalidation telemetry onto that lens for loaded threads, project a targeted graph/evidence context shard from the map, traverse bounded graph neighborhoods and path/symbol matches from the map, project context pressure from token telemetry, bank an in-flight investigation packet in durable typed state, reflect that packet back into prompt/scene/context, turn those signals into a read-only resume-versus-regather verdict, recommend the next explicit CRRC action over the verdict and worker/result state, print that recommendation in a dogfood operator view, explicitly launch one bounded `reorient-worker` job from that verdict, read its result back for review, explicitly accept a completed finding into typed state, 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 invalidate stale graph regions automatically, execute Epiphany-owned long-running jobs beyond the borrowed runtime `agent_jobs` backend, or coordinate broad specialist ownership. Teeth are installed; chewing is supervised; the first bell rings; the first wall board exists; the first shift board exists; the first freshness clipboard exists; the first door sensor now exists too; the first binder lens exists; the first graph-walk lens exists; the first pressure gauge exists; the first ember packet exists; the first verdict slip now exists too; the first bounded launch lever and stop switch now exist too; the first explicit wakeup-hand now exists too; the first coordinator clipboard now exists too; the first operator readout exists too. The next slices are about giving real roles real ownership, not jawbones.
|
||||
|
||||
The role board and fixed specialist templates now exist too. Current Epiphany can project implementation, modeling/checkpoint, verification/review, and reorientation ownership through `thread/epiphany/roles`, explicitly launch fixed modeling/verification workers, read their findings back, and keep semantic acceptance review-gated. What remains is dogfooding the operator loop until real product friction, not imagined architecture guilt, tells us the next organ.
|
||||
The role board, fixed specialist templates, and first modeling accept path now exist too. Current Epiphany can project implementation, modeling/checkpoint, verification/review, and reorientation ownership through `thread/epiphany/roles`, explicitly launch fixed modeling/verification workers, read their findings back, apply reviewed modeling graph/checkpoint patches through `thread/epiphany/roleAccept`, and keep semantic acceptance review-gated. What remains is dogfooding the operator loop until real product friction, not imagined architecture guilt, tells us the next organ.
|
||||
|
||||
## Verification Hooks
|
||||
|
||||
|
|
@ -1500,7 +1501,7 @@ Current tests cover the landed flows at useful seams:
|
|||
- live app-server smoke for the first bounded reorient-launch runtime consumer plus CRRC coordinator recommendations in `tools/epiphany_phase6_reorient_launch_smoke.py`.
|
||||
- live app-server smoke for the first MVP operator status view in `tools/epiphany_mvp_status_smoke.py`.
|
||||
- focused app-server mapper coverage for `thread/epiphany/roles`, plus MVP status smoke coverage that consumes the roles surface.
|
||||
- focused app-server/protocol coverage for `thread/epiphany/roleLaunch` and `thread/epiphany/roleResult`, plus live role smoke coverage that launches modeling and verification workers and reads completed results without state mutation.
|
||||
- focused app-server/protocol coverage for `thread/epiphany/roleLaunch`, `thread/epiphany/roleResult`, and `thread/epiphany/roleAccept`, plus live role smoke coverage that launches modeling and verification workers, reads completed results, accepts a reviewed modeling graph patch, and proves the durable graph grows before verification sees the expanded frontier.
|
||||
- live app-server smoke for the first Phase 6 job-control boundary in `tools/epiphany_phase6_job_control_smoke.py`.
|
||||
- live app-server smoke for explicit Phase 6 role launch/read-back in `tools/epiphany_phase6_role_smoke.py`.
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ The landed machine now has:
|
|||
- limited native Phase 6 CRRC automation at turn-complete safe boundaries, restricted to coordinator-approved compact and fixed reorient-worker launch actions
|
||||
- read-only Phase 6 role ownership through `thread/epiphany/roles`, projecting implementation, modeling/checkpoint, verification/review, and reorientation lanes from typed state plus jobs/CRRC/result signals
|
||||
- explicit Phase 6 role launch/read-back through `thread/epiphany/roleLaunch` and read-only `thread/epiphany/roleResult`, limited to fixed modeling/checkpoint and verification/review templates over the existing job-control seam
|
||||
- review-gated Phase 6 modeling acceptance through `thread/epiphany/roleAccept`, limited to completed modeling/checkpoint `statePatch` findings that apply graph/frontier/checkpoint/scratch/investigation-checkpoint changes through the existing state validator
|
||||
- first Phase 6 dogfood operator view through `tools/epiphany_mvp_status.py`
|
||||
- first auditable Phase 6 dogfood runner through `tools/epiphany_mvp_dogfood.py`, producing local status snapshots, raw app-server transcript, final status artifacts, truthful vanilla-reference output, and comparison notes
|
||||
- first auditable Phase 6 fixed-lane coordinator runner through `tools/epiphany_mvp_coordinator.py`, producing coordinator summary, JSONL steps, rendered snapshots, transcript, stderr, and final next-action artifacts while keeping semantic findings review-gated by default
|
||||
|
|
@ -121,6 +122,7 @@ These boundaries are more important than the individual method names:
|
|||
- `thread/epiphany/roles` is a read-only role ownership projection, not a specialist scheduler, marketplace, launcher, acceptance gate, or second job backend.
|
||||
- `thread/epiphany/roleLaunch` is a bounded authority surface for fixed modeling/checkpoint and verification/review templates, not a broad scheduler or specialist marketplace.
|
||||
- `thread/epiphany/roleResult` is a read-only result projection, not a promotion gate, state writer, scheduler, or hidden continuation trigger.
|
||||
- `thread/epiphany/roleAccept` is a narrow modeling/checkpoint acceptance write, not automatic specialist promotion, a verifier substitute, a broad state editor, or permission for workers to accept their own output.
|
||||
- The GUI may render and steer typed state, but it must not manufacture canonical understanding.
|
||||
- The MVP GUI target is a local Tauri v2 + React operator app over the existing app-server APIs. Tauri owns windowing and local lifecycle; app-server and typed Epiphany state remain authoritative.
|
||||
- The app-server remains a host seam; Epiphany-owned machinery should live in `epiphany-core` where practical.
|
||||
|
|
@ -203,11 +205,13 @@ blockers are now landed as
|
|||
`thread/epiphany/reorientResult`, `thread/epiphany/reorientAccept`,
|
||||
`thread/epiphany/crrc`, `tools/epiphany_mvp_status.py`,
|
||||
`thread/epiphany/coordinator`, `tools/epiphany_mvp_coordinator.py`, and
|
||||
`thread/epiphany/roles`, `thread/epiphany/roleLaunch`, and
|
||||
`thread/epiphany/roleResult`. A human can now ask the harness what it believes,
|
||||
`thread/epiphany/roles`, `thread/epiphany/roleLaunch`,
|
||||
`thread/epiphany/roleResult`, and `thread/epiphany/roleAccept`. A human can now ask the harness what it believes,
|
||||
what it recommends, which role lane owns the next visible work, which fixed-lane
|
||||
action should happen next, explicitly launch modeling/checkpoint or
|
||||
verification/review workers, and read their findings back without reading Rust.
|
||||
verification/review workers, read their findings back without reading Rust, and
|
||||
apply a reviewed modeling graph/checkpoint patch without pretending the modeler
|
||||
can silently promote itself.
|
||||
The first auditable dogfood pass then added
|
||||
`tools/epiphany_mvp_dogfood.py`, rendered modeling/verification findings in the
|
||||
status view, and fixed CRRC's repeat-acceptance recommendation after
|
||||
|
|
@ -270,6 +274,7 @@ Initial shape:
|
|||
- run coordinator pass
|
||||
- prepare a durable checkpoint for a resumable operator thread
|
||||
- launch fixed modeling/checkpoint role
|
||||
- accept a completed modeling/checkpoint `statePatch` after review
|
||||
- launch fixed verification/review role
|
||||
- launch fixed reorient-worker when recommended
|
||||
- accept a completed reorientation finding after review
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ Do not trust this file for the exact live HEAD. Always check git.
|
|||
|
||||
- Do not copy exact branch or HEAD from this note. Run `git status --short --branch` and `git log --oneline -5`.
|
||||
- Phase 1 through Phase 5 are complete enough.
|
||||
- Phase 6 has read-only `thread/epiphany/scene`, `thread/epiphany/jobs`, `thread/epiphany/roles`, `thread/epiphany/freshness`, `thread/epiphany/context`, `thread/epiphany/graphQuery`, `thread/epiphany/pressure`, `thread/epiphany/reorient`, `thread/epiphany/crrc`, `thread/epiphany/coordinator`, `thread/epiphany/reorientResult`, and `thread/epiphany/roleResult`; durable `jobBindings` now act as a thin Epiphany-owned launcher seam with launcher id, authority scope, and backend kind/job id, `thread/epiphany/jobLaunch` / `thread/epiphany/jobInterrupt` / `thread/epiphany/roleLaunch` now provide explicit bounded authority over that seam, jobs can overlay it onto live runtime `agent_jobs` progress for loaded threads, and `thread/epiphany/jobsUpdated` now translates live `agent_job_progress:{json}` background events into changed launcher-bound notifications without polling or scheduling. Freshness carries watcher-backed invalidation inputs, graphQuery traverses authoritative typed graph neighborhoods and path/symbol matches without mutation, roles project implementation/modeling/verification/reorientation ownership from existing signals without becoming a scheduler, `roleLaunch` can launch only fixed modeling/checkpoint or verification/review specialists, `roleResult` reads those outputs back as reviewable findings without mutation, reorient turns checkpoint plus freshness/pressure/watcher signals into a read-only resume-versus-regather verdict, `thread/epiphany/reorientLaunch` is the explicit runtime consumer over that verdict, `thread/epiphany/reorientResult` reads the launched worker output back as a reviewable finding without mutation or promotion, `thread/epiphany/reorientAccept` explicitly banks completed findings into accepted observation/evidence plus optional scratch/checkpoint state, `thread/epiphany/crrc` recommends the next explicit CRRC action without launching, accepting, compacting, scheduling, or mutating, and `thread/epiphany/coordinator` composes those signals into a fixed-lane MVP action recommendation without becoming a writer.
|
||||
- Phase 6 has read-only `thread/epiphany/scene`, `thread/epiphany/jobs`, `thread/epiphany/roles`, `thread/epiphany/freshness`, `thread/epiphany/context`, `thread/epiphany/graphQuery`, `thread/epiphany/pressure`, `thread/epiphany/reorient`, `thread/epiphany/crrc`, `thread/epiphany/coordinator`, `thread/epiphany/reorientResult`, and `thread/epiphany/roleResult`; durable `jobBindings` now act as a thin Epiphany-owned launcher seam with launcher id, authority scope, and backend kind/job id, `thread/epiphany/jobLaunch` / `thread/epiphany/jobInterrupt` / `thread/epiphany/roleLaunch` now provide explicit bounded authority over that seam, jobs can overlay it onto live runtime `agent_jobs` progress for loaded threads, and `thread/epiphany/jobsUpdated` now translates live `agent_job_progress:{json}` background events into changed launcher-bound notifications without polling or scheduling. Freshness carries watcher-backed invalidation inputs, graphQuery traverses authoritative typed graph neighborhoods and path/symbol matches without mutation, roles project implementation/modeling/verification/reorientation ownership from existing signals without becoming a scheduler, `roleLaunch` can launch only fixed modeling/checkpoint or verification/review specialists, `roleResult` reads those outputs back as reviewable findings without mutation, `thread/epiphany/roleAccept` can apply a reviewed modeling/checkpoint `statePatch` through the existing state validator, reorient turns checkpoint plus freshness/pressure/watcher signals into a read-only resume-versus-regather verdict, `thread/epiphany/reorientLaunch` is the explicit runtime consumer over that verdict, `thread/epiphany/reorientResult` reads the launched worker output back as a reviewable finding without mutation or promotion, `thread/epiphany/reorientAccept` explicitly banks completed findings into accepted observation/evidence plus optional scratch/checkpoint state, `thread/epiphany/crrc` recommends the next explicit CRRC action without launching, accepting, compacting, scheduling, or mutating, and `thread/epiphany/coordinator` composes those signals into a fixed-lane MVP action recommendation without becoming a writer.
|
||||
- `tools/epiphany_mvp_status.py` is the first dogfood operator view. It starts or reads a thread through app-server and prints scene, pressure, reorient, jobs, roles, modeling/verification role result read-backs, reorient result, and CRRC recommendation as text or JSON.
|
||||
- `tools/epiphany_mvp_coordinator.py` is the first auditable fixed-lane coordinator runner. It starts or reads a thread through app-server, follows the harness-native coordinator action, can auto-launch modeling, verification, or reorient-worker jobs, keeps semantic findings review-gated by default, and writes summary, steps, rendered snapshots, transcript, stderr, and final next-action artifacts under `.epiphany-dogfood/coordinator` or a caller-provided artifact directory.
|
||||
- Native CRRC automation is now landed only at turn-complete safe boundaries. It may submit `Op::Compact` for coordinator-approved `compactRehydrateReorient`, and it may launch the fixed `reorient-worker` for coordinator-approved `launchReorientWorker`. It does not auto-launch modeling/verification, accept findings, promote evidence, edit implementation code, or keep going after reviewable semantic output.
|
||||
|
|
@ -75,6 +75,7 @@ The current spine:
|
|||
- explicit launch/interrupt authority through `thread/epiphany/jobLaunch` and `thread/epiphany/jobInterrupt`
|
||||
- explicit modeling/checkpoint and verification/review specialist launch through `thread/epiphany/roleLaunch`
|
||||
- read-only modeling/checkpoint and verification/review specialist result read-back through `thread/epiphany/roleResult`
|
||||
- review-gated modeling/checkpoint patch acceptance through `thread/epiphany/roleAccept`
|
||||
- bounded reorient-guided worker launch through `thread/epiphany/reorientLaunch`
|
||||
- read-only reorient-worker result read-back through `thread/epiphany/reorientResult`
|
||||
- explicit reorient-worker finding acceptance through `thread/epiphany/reorientAccept`
|
||||
|
|
@ -130,8 +131,9 @@ The exact current control flow is documented in
|
|||
- `thread/epiphany/coordinator` is read-only.
|
||||
- `thread/epiphany/roles` is read-only.
|
||||
- `thread/epiphany/roleResult` is read-only.
|
||||
- `thread/epiphany/roleAccept` is a narrow write surface for completed modeling/checkpoint `statePatch` findings only; it must not accept verification output, broad authority fields, job bindings, or arbitrary implementation work.
|
||||
- `thread/epiphany/reorientResult` is read-only.
|
||||
- Durable typed state writes go through `thread/epiphany/update`, accepted `thread/epiphany/promote`, `thread/epiphany/reorientAccept`, or the bounded `thread/epiphany/jobLaunch`, `thread/epiphany/jobInterrupt`, `thread/epiphany/reorientLaunch`, and `thread/epiphany/roleLaunch` authority surfaces when they mutate `jobBindings`.
|
||||
- Durable typed state writes go through `thread/epiphany/update`, accepted `thread/epiphany/promote`, `thread/epiphany/reorientAccept`, `thread/epiphany/roleAccept`, or the bounded `thread/epiphany/jobLaunch`, `thread/epiphany/jobInterrupt`, `thread/epiphany/reorientLaunch`, and `thread/epiphany/roleLaunch` authority surfaces when they mutate typed state or `jobBindings`.
|
||||
- `thread/epiphany/index` writes the retrieval catalog, not durable Epiphany understanding.
|
||||
- GUI/client surfaces reflect and steer typed state; they do not become the source of truth.
|
||||
- Do not restart Phase 5 hardening without a concrete regression.
|
||||
|
|
@ -313,6 +315,9 @@ The first live-specialist pass has also run. It produced
|
|||
`roleLaunch` created a bound `agent_jobs` row, the spawned modeling worker
|
||||
inspected the smoke workspace, called `report_agent_job_result`, and
|
||||
`roleResult` projected a completed `checkpoint-ready` finding.
|
||||
The role smoke now also proves modeling can return a reviewable graph/checkpoint
|
||||
`statePatch` and `thread/epiphany/roleAccept` can apply it so the durable graph
|
||||
actually grows after review.
|
||||
|
||||
The prompt doctrine pass has now also run. It rechecked global AGENTS,
|
||||
available Codex memories, and nearby evidence ledgers before distilling the
|
||||
|
|
|
|||
|
|
@ -32,3 +32,4 @@
|
|||
{"ts": "2026-04-29T20:49:06+00:00", "type": "verification", "status": "ok", "note": "thread/epiphany/graphQuery landed as a read-only graph traversal surface: explicit node/edge lookup, path/symbol matching, edge-kind matching, bounded neighbor walks, and frontier neighborhoods over authoritative typed state, live-smoked without stateUpdated notifications or revision mutation."}
|
||||
{"ts": "2026-04-29T23:32:51+00:00", "type": "verification", "status": "ok", "note": "Distilled prompt doctrine landed after rechecking global AGENTS, empty Codex memory surfaces, and nearby evidence ledgers: shared prompts now carry state/memory/source/anti-churn discipline; specialist templates split modeling/body, verification/soul, reorientation/life, and coordinator/Self. Verified with epiphany-core tests, codex-protocol tests, focused app-server template tests, role/reorient/status/coordinator smokes, and live-specialist artifacts."}
|
||||
{"ts": "2026-04-30T00:07:45+00:00", "type": "implementation", "status": "ok", "note": "Specialist prompt bodies were extracted from Rust into vendor/codex/codex-rs/app-server/src/prompts/epiphany_specialists.toml. app-server now parses the bundled TOML once and uses it for modeling/body, verification/soul, reorientation/life, and coordinator/Self text while keeping fixed-lane launch policy in Rust. Verified with app-server config/template tests, role/reorient/coordinator smokes, and live-specialist artifacts."}
|
||||
{"ts": "2026-04-30T00:42:00+00:00", "type": "implementation", "status": "ok", "note": "Modeling/checkpoint specialists now have a review-gated graph-growth path: their prompt/output contract can return a modeling-safe statePatch, thread/epiphany/roleResult projects it when valid, thread/epiphany/roleAccept applies completed modeling patches through the normal state validator with audit observation/evidence, and the GUI exposes Accept Modeling. Phase6 role smoke proved accepted modeling grew the durable graph before verification saw the expanded frontier."}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ accepted_design:
|
|||
- Authoritative Epiphany state lives in Codex protocol/core session and rollout state.
|
||||
- The prompt reads typed state through a bounded `<epiphany_state>` developer fragment.
|
||||
- Clients read typed state through `Thread.epiphanyState`, compact reflections such as `thread/epiphany/scene`, `thread/epiphany/jobs`, and `thread/epiphany/freshness`, targeted state shards through `thread/epiphany/context`, bounded graph traversal through `thread/epiphany/graphQuery`, runtime pressure through `thread/epiphany/pressure`, bounded CRRC reorientation verdicts through `thread/epiphany/reorient`, read-only CRRC next-action recommendations through `thread/epiphany/crrc`, role ownership through `thread/epiphany/roles`, reviewable role output through `thread/epiphany/roleResult`, and live bound-job progress through `thread/epiphany/jobsUpdated`.
|
||||
- Durable typed state writes route through `thread/epiphany/update`, accepted `thread/epiphany/promote`, or the bounded `thread/epiphany/jobLaunch`, `thread/epiphany/jobInterrupt`, `thread/epiphany/reorientLaunch`, and `thread/epiphany/roleLaunch` authority surfaces when they mutate `job_bindings`.
|
||||
- Durable typed state writes route through `thread/epiphany/update`, accepted `thread/epiphany/promote`, `thread/epiphany/reorientAccept`, `thread/epiphany/roleAccept`, or the bounded `thread/epiphany/jobLaunch`, `thread/epiphany/jobInterrupt`, `thread/epiphany/reorientLaunch`, and `thread/epiphany/roleLaunch` authority surfaces when they mutate state or `job_bindings`.
|
||||
- `thread/epiphany/retrieve`, `thread/epiphany/distill`, `thread/epiphany/propose`, `thread/epiphany/scene`, `thread/epiphany/jobs`, `thread/epiphany/freshness`, `thread/epiphany/context`, `thread/epiphany/graphQuery`, `thread/epiphany/pressure`, and `thread/epiphany/reorient` stay read-only.
|
||||
- `thread/epiphany/index` writes the retrieval catalog, not durable Epiphany understanding.
|
||||
- Qdrant is the preferred persistent semantic backend; BM25 remains the bootstrap/fallback/control path.
|
||||
|
|
@ -94,6 +94,7 @@ accepted_design:
|
|||
- `tools/epiphany_mvp_status.py` is the first dogfood operator view: it starts or reads a thread through app-server and renders scene, pressure, reorient, jobs, role result read-backs, reorient result, CRRC recommendation, and MVP role lanes as text or JSON without becoming a state store.
|
||||
- `thread/epiphany/roles` is the first harness-native role ownership surface: it projects implementation, modeling/checkpoint, verification/review, and reorientation lanes from authoritative typed state, bound jobs, pressure/reorient/CRRC, and worker result status without launching, scheduling, accepting, compacting, or mutating state.
|
||||
- `thread/epiphany/roleLaunch` and `thread/epiphany/roleResult` are the first explicit role-scoped specialist templates: modeling/checkpoint and verification/review can be launched through fixed bindings over the existing job-control seam and read back as reviewable findings, while implementation stays owned by the main coding agent and reorientation stays on the CRRC-specific launch/result path.
|
||||
- `thread/epiphany/roleAccept` is the first review-gated role finding acceptance path: it currently accepts only completed modeling/checkpoint findings with a valid `statePatch`, applies only modeling-safe fields such as graphs/frontier/checkpoints/scratch/investigation checkpoint plus audit observation/evidence, and rejects verification or broad authority fields.
|
||||
- `thread/epiphany/reorientLaunch` is the first bounded runtime consumer over the reorientation verdict: it launches one fixed `reorient-worker` job through the existing job-control seam with explicit resume-versus-regather scope, authority, and checkpoint-derived payload, without making `thread/epiphany/reorient` a writer or turning CRRC into an ambient scheduler.
|
||||
- `thread/epiphany/reorientResult` is the first bounded read-back surface for that worker: it reads the fixed or requested reorient-worker binding through the current `agent_jobs` backend and projects completed output as a reviewable finding without mutation, promotion, scheduling, or hidden continuation.
|
||||
- `thread/epiphany/reorientAccept` is the first explicit acceptance write for completed reorient-worker findings: it appends accepted observation/evidence records, can optionally update scratch and investigation checkpoint state, and emits `stateUpdated` with source `reorientAccept` without accepting pending work or launching follow-up work.
|
||||
|
|
@ -127,6 +128,7 @@ landed_baseline:
|
|||
- Phase 6 live specialist runner: auditable real worker loop over roleLaunch, agent_jobs worker execution, report_agent_job_result, roleResult, status rendering, and transcript artifacts.
|
||||
- Phase 6 role ownership: read-only `thread/epiphany/roles` over implementation, modeling/checkpoint, verification/review, and reorientation lanes.
|
||||
- Phase 6 role specialists: explicit `thread/epiphany/roleLaunch` and read-only `thread/epiphany/roleResult` templates for modeling/checkpoint and verification/review.
|
||||
- Phase 6 modeling role acceptance: explicit `thread/epiphany/roleAccept` for reviewed modeling/checkpoint `statePatch` findings that can grow graphs/frontier/checkpoints through the existing state validator.
|
||||
- Phase 6 coordinator: read-only `thread/epiphany/coordinator` plus `tools/epiphany_mvp_coordinator.py` and smoke coverage for the fixed-lane MVP loop.
|
||||
- Phase 6 safe-boundary CRRC automation: turn-complete automation limited to coordinator-approved compact and fixed reorient-worker launch actions.
|
||||
- Phase 6 pre-compaction checkpoint intervention: token-count pressure hook that steers active turns once when `shouldPrepareCompaction` is reached so working context is banked before compaction.
|
||||
|
|
@ -168,5 +170,5 @@ rejected_paths:
|
|||
reason: persistent state that accumulates every local truth becomes memory cruft and weakens rehydration
|
||||
|
||||
current_status:
|
||||
summary: Phase 1 durable state, Phase 2 prompt integration, Phase 3 typed read, Phase 4 retrieval/indexing, Phase 5 update/distill/propose/promote/read/notification, and Phase 6 read-only scene, jobs, roles, freshness, targeted context, graph traversal, pressure, reorient, CRRC, coordinator, reorient launch/result/accept, explicit modeling/checkpoint and verification/review role launch/result templates, MVP status, dogfood runner, coordinator runner, live specialist runner, limited safe-boundary CRRC automation, pre-compaction checkpoint intervention, the first Tauri/React GUI operator shell, and the distilled shared plus config-backed specialist prompt doctrine are landed. Native CRRC can steer active loaded Epiphany turns once at `shouldPrepareCompaction`; turn-complete automation can still compact or launch the fixed reorient-worker when the coordinator says it can auto-run. The GUI now has desktop/mobile visual smoke, durable checkpoint preparation, bounded status/coordinator artifact buttons, fixed role/reorient launch and read-back buttons, and explicit reorientAccept after a completed result. Implementation remains main-agent work; CRRC remains workflow automation, not a specialist persona; GUI remains an operator surface over typed state, not a source of truth.
|
||||
summary: Phase 1 durable state, Phase 2 prompt integration, Phase 3 typed read, Phase 4 retrieval/indexing, Phase 5 update/distill/propose/promote/read/notification, and Phase 6 read-only scene, jobs, roles, freshness, targeted context, graph traversal, pressure, reorient, CRRC, coordinator, reorient launch/result/accept, explicit modeling/checkpoint and verification/review role launch/result templates, review-gated modeling role acceptance, MVP status, dogfood runner, coordinator runner, live specialist runner, limited safe-boundary CRRC automation, pre-compaction checkpoint intervention, the first Tauri/React GUI operator shell, and the distilled shared plus config-backed specialist prompt doctrine are landed. Native CRRC can steer active loaded Epiphany turns once at `shouldPrepareCompaction`; turn-complete automation can still compact or launch the fixed reorient-worker when the coordinator says it can auto-run. The GUI now has desktop/mobile visual smoke, durable checkpoint preparation, bounded status/coordinator artifact buttons, fixed role/reorient launch and read-back buttons, explicit modeling `roleAccept` for reviewed graph/checkpoint patches, and explicit reorientAccept after a completed result. Implementation remains main-agent work; CRRC remains workflow automation, not a specialist persona; GUI remains an operator surface over typed state, not a source of truth.
|
||||
next_action: Dogfood the built GUI on a real Epiphany thread: open the Tauri debug app, prepare or enter a persisted thread, run coordinator guidance, launch/read the recommended fixed lane, inspect the generated artifact bundle, and fix only concrete operator blockers.
|
||||
|
|
|
|||
|
|
@ -263,6 +263,18 @@ def run_action(args: argparse.Namespace) -> dict[str, Any]:
|
|||
"thread/epiphany/roleResult", {"threadId": thread_id, "roleId": role_id}
|
||||
)
|
||||
summary = f"Read {role_id} role result."
|
||||
elif args.action == "acceptModeling":
|
||||
if revision is None:
|
||||
raise ValueError("acceptModeling requires ready Epiphany state with a revision")
|
||||
response = client.send(
|
||||
"thread/epiphany/roleAccept",
|
||||
{
|
||||
"threadId": thread_id,
|
||||
"roleId": "modeling",
|
||||
"expectedRevision": revision,
|
||||
},
|
||||
)
|
||||
summary = "Accepted reviewed modeling graph/checkpoint patch."
|
||||
elif args.action == "launchReorient":
|
||||
payload = {"threadId": thread_id, "maxRuntimeSeconds": args.max_runtime_seconds}
|
||||
if revision is not None:
|
||||
|
|
@ -324,6 +336,7 @@ def main() -> int:
|
|||
choices=[
|
||||
"launchModeling",
|
||||
"readModelingResult",
|
||||
"acceptModeling",
|
||||
"launchVerification",
|
||||
"readVerificationResult",
|
||||
"launchReorient",
|
||||
|
|
|
|||
|
|
@ -176,6 +176,16 @@ def render_status(status: dict[str, Any]) -> str:
|
|||
lines.append(f" verdict: {maybe(finding.get('verdict'))}")
|
||||
lines.append(f" summary: {maybe(finding.get('summary'))}")
|
||||
lines.append(f" next: {maybe(finding.get('nextSafeMove'))}")
|
||||
lines.append(
|
||||
" state patch: "
|
||||
+ ("available" if isinstance(finding.get("statePatch"), dict) else "none")
|
||||
)
|
||||
if finding.get("openQuestions"):
|
||||
lines.append(f" open questions: {', '.join(map(str, finding['openQuestions']))}")
|
||||
if finding.get("evidenceGaps"):
|
||||
lines.append(f" evidence gaps: {', '.join(map(str, finding['evidenceGaps']))}")
|
||||
if finding.get("risks"):
|
||||
lines.append(f" risks: {', '.join(map(str, finding['risks']))}")
|
||||
|
||||
lines.extend(
|
||||
[
|
||||
|
|
|
|||
|
|
@ -50,6 +50,42 @@ def complete_role_backend_job(
|
|||
"frontierNodeIds": [GRAPH_NODE_ID],
|
||||
"evidenceIds": ["ev-checkpoint"],
|
||||
}
|
||||
if role_id == "modeling":
|
||||
patch = reorient_patch()
|
||||
graphs = patch["graphs"]
|
||||
graphs["architecture"]["nodes"].append(
|
||||
{
|
||||
"id": "accepted-modeling-node",
|
||||
"title": "Accepted modeling node",
|
||||
"purpose": "Proves a modeling role finding can grow the durable graph after review.",
|
||||
"code_refs": [
|
||||
{
|
||||
"path": WATCHED_RELATIVE_PATH.as_posix(),
|
||||
"start_line": 1,
|
||||
"end_line": 3,
|
||||
"symbol": "reorient_target",
|
||||
}
|
||||
],
|
||||
}
|
||||
)
|
||||
result["statePatch"] = {
|
||||
"graphs": graphs,
|
||||
"graphFrontier": {
|
||||
"active_node_ids": [GRAPH_NODE_ID, "accepted-modeling-node"],
|
||||
"dirty_paths": [],
|
||||
},
|
||||
"graphCheckpoint": {
|
||||
"checkpoint_id": "ck-modeling-accepted",
|
||||
"graph_revision": 2,
|
||||
"summary": "Modeling role accepted a graph-growth checkpoint.",
|
||||
"frontier_node_ids": [GRAPH_NODE_ID, "accepted-modeling-node"],
|
||||
},
|
||||
"scratch": {
|
||||
"summary": "Modeling role found a graph growth candidate.",
|
||||
"current_focus": "Review-gated modeling acceptance smoke.",
|
||||
"next_action": "Verify the accepted graph node is visible in durable Epiphany state.",
|
||||
},
|
||||
}
|
||||
now = int(time.time())
|
||||
db_path = locate_state_db(codex_home)
|
||||
connection = sqlite3.connect(db_path)
|
||||
|
|
@ -89,6 +125,7 @@ def assert_role_job(
|
|||
owner_role: str,
|
||||
authority_scope: str,
|
||||
scope: str,
|
||||
expected_graph_node_ids: list[str] | None = None,
|
||||
) -> None:
|
||||
require(job["id"] == binding_id, f"{binding_id} should use the fixed binding id")
|
||||
require(job["kind"] == "specialist", f"{binding_id} should use a specialist job")
|
||||
|
|
@ -105,7 +142,11 @@ def assert_role_job(
|
|||
f"{binding_id} should align runtime and backend ids",
|
||||
)
|
||||
require(job["linkedSubgoalIds"] == [SUBGOAL_ID], f"{binding_id} should bind subgoal")
|
||||
require(job["linkedGraphNodeIds"] == [GRAPH_NODE_ID], f"{binding_id} should bind frontier")
|
||||
expected_graph_node_ids = expected_graph_node_ids or [GRAPH_NODE_ID]
|
||||
require(
|
||||
job["linkedGraphNodeIds"] == expected_graph_node_ids,
|
||||
f"{binding_id} should bind frontier",
|
||||
)
|
||||
|
||||
|
||||
def launch_role(
|
||||
|
|
@ -273,14 +314,55 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]:
|
|||
scope="role-scoped modeling/checkpoint maintenance",
|
||||
)
|
||||
|
||||
accept_start = len(client.notifications)
|
||||
modeling_accept = client.send(
|
||||
"thread/epiphany/roleAccept",
|
||||
{
|
||||
"threadId": thread_id,
|
||||
"roleId": "modeling",
|
||||
"expectedRevision": 2,
|
||||
},
|
||||
)
|
||||
assert modeling_accept is not None
|
||||
require(
|
||||
modeling_accept["changedFields"]
|
||||
== [
|
||||
"graphs",
|
||||
"graphFrontier",
|
||||
"graphCheckpoint",
|
||||
"scratch",
|
||||
"observations",
|
||||
"evidence",
|
||||
],
|
||||
"modeling accept should apply only modeling patch fields plus audit records",
|
||||
)
|
||||
require(
|
||||
modeling_accept["appliedPatch"]["graphs"]["architecture"]["nodes"][-1]["id"]
|
||||
== "accepted-modeling-node",
|
||||
"modeling accept should apply the reviewed graph patch",
|
||||
)
|
||||
accept_notification = client.wait_for_notification(
|
||||
"thread/epiphany/stateUpdated",
|
||||
start_index=accept_start,
|
||||
timeout=15.0,
|
||||
)
|
||||
require(
|
||||
accept_notification["params"]["source"] == "roleAccept",
|
||||
"modeling accept should emit roleAccept state update source",
|
||||
)
|
||||
require(
|
||||
accept_notification["params"]["revision"] == 3,
|
||||
"modeling accept should advance durable revision",
|
||||
)
|
||||
|
||||
verification_launch = launch_role(
|
||||
client,
|
||||
thread_id,
|
||||
role_id="verification",
|
||||
expected_revision=2,
|
||||
expected_revision=3,
|
||||
)
|
||||
require(
|
||||
verification_launch["revision"] == 3,
|
||||
verification_launch["revision"] == 4,
|
||||
"verification launch should advance revision",
|
||||
)
|
||||
assert_role_job(
|
||||
|
|
@ -289,6 +371,7 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]:
|
|||
owner_role="epiphany-verifier",
|
||||
authority_scope="epiphany.role.verification",
|
||||
scope="role-scoped verification/review",
|
||||
expected_graph_node_ids=[GRAPH_NODE_ID, "accepted-modeling-node"],
|
||||
)
|
||||
verification_payload = complete_role_backend_job(
|
||||
codex_home,
|
||||
|
|
@ -308,7 +391,7 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]:
|
|||
role_id="verification",
|
||||
binding_id=VERIFICATION_BINDING_ID,
|
||||
payload=verification_payload,
|
||||
expected_revision=3,
|
||||
expected_revision=4,
|
||||
)
|
||||
client.require_no_notification(
|
||||
"thread/epiphany/stateUpdated",
|
||||
|
|
@ -318,9 +401,17 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]:
|
|||
final_read = client.send("thread/read", {"threadId": thread_id, "includeTurns": False})
|
||||
assert final_read is not None
|
||||
require(
|
||||
final_read["thread"]["epiphanyState"]["revision"] == 3,
|
||||
final_read["thread"]["epiphanyState"]["revision"] == 4,
|
||||
"role result read-back should not mutate durable state",
|
||||
)
|
||||
graph_ids = [
|
||||
node["id"]
|
||||
for node in final_read["thread"]["epiphanyState"]["graphs"]["architecture"]["nodes"]
|
||||
]
|
||||
require(
|
||||
"accepted-modeling-node" in graph_ids,
|
||||
"accepted modeling result should grow the durable graph",
|
||||
)
|
||||
|
||||
result = {
|
||||
"threadId": thread_id,
|
||||
|
|
@ -329,6 +420,8 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]:
|
|||
"modelingRevision": modeling_launch["revision"],
|
||||
"modelingResultStatus": modeling_result["status"],
|
||||
"modelingNextSafeMove": modeling_result["finding"]["nextSafeMove"],
|
||||
"modelingAcceptRevision": modeling_accept["revision"],
|
||||
"modelingAcceptedNode": "accepted-modeling-node",
|
||||
"verificationRevision": verification_launch["revision"],
|
||||
"verificationResultStatus": verification_result["status"],
|
||||
"verificationVerdict": verification_result["finding"]["verdict"],
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ def assert_missing_scene(scene: dict[str, Any]) -> None:
|
|||
"coordinator",
|
||||
"roleLaunch",
|
||||
"roleResult",
|
||||
"roleAccept",
|
||||
"jobLaunch",
|
||||
"freshness",
|
||||
"pressure",
|
||||
|
|
@ -251,6 +252,7 @@ def assert_ready_scene(scene: dict[str, Any], expected_revision: int) -> None:
|
|||
"coordinator",
|
||||
"roleLaunch",
|
||||
"roleResult",
|
||||
"roleAccept",
|
||||
"jobLaunch",
|
||||
"freshness",
|
||||
"pressure",
|
||||
|
|
|
|||
|
|
@ -366,6 +366,11 @@ client_request_definitions! {
|
|||
params: v2::ThreadEpiphanyRoleResultParams,
|
||||
response: v2::ThreadEpiphanyRoleResultResponse,
|
||||
},
|
||||
#[experimental("thread/epiphany/roleAccept")]
|
||||
ThreadEpiphanyRoleAccept => "thread/epiphany/roleAccept" {
|
||||
params: v2::ThreadEpiphanyRoleAcceptParams,
|
||||
response: v2::ThreadEpiphanyRoleAcceptResponse,
|
||||
},
|
||||
#[experimental("thread/epiphany/freshness")]
|
||||
ThreadEpiphanyFreshness => "thread/epiphany/freshness" {
|
||||
params: v2::ThreadEpiphanyFreshnessParams,
|
||||
|
|
@ -2258,6 +2263,10 @@ mod tests {
|
|||
files_inspected: vec!["src/lib.rs".to_string()],
|
||||
frontier_node_ids: vec!["state-spine".to_string()],
|
||||
evidence_ids: vec!["ev-1".to_string()],
|
||||
open_questions: Vec::new(),
|
||||
evidence_gaps: Vec::new(),
|
||||
risks: Vec::new(),
|
||||
state_patch: None,
|
||||
job_error: None,
|
||||
item_error: None,
|
||||
raw_result: json!({
|
||||
|
|
@ -2324,6 +2333,115 @@ mod tests {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_thread_epiphany_role_accept_response() -> Result<()> {
|
||||
let patch = v2::ThreadEpiphanyUpdatePatch {
|
||||
graph_frontier: Some(codex_protocol::protocol::EpiphanyGraphFrontier {
|
||||
active_node_ids: vec!["state-spine".to_string()],
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
let finding = v2::ThreadEpiphanyRoleFinding {
|
||||
role_id: v2::ThreadEpiphanyRoleId::Modeling,
|
||||
verdict: Some("checkpoint-update-needed".to_string()),
|
||||
summary: Some("Graph frontier should keep state-spine active.".to_string()),
|
||||
next_safe_move: Some("Accept the reviewed modeling patch.".to_string()),
|
||||
checkpoint_summary: None,
|
||||
scratch_summary: None,
|
||||
files_inspected: vec!["src/lib.rs".to_string()],
|
||||
frontier_node_ids: vec!["state-spine".to_string()],
|
||||
evidence_ids: Vec::new(),
|
||||
open_questions: Vec::new(),
|
||||
evidence_gaps: Vec::new(),
|
||||
risks: Vec::new(),
|
||||
state_patch: Some(patch.clone()),
|
||||
job_error: None,
|
||||
item_error: None,
|
||||
raw_result: json!({
|
||||
"verdict": "checkpoint-update-needed",
|
||||
"summary": "Graph frontier should keep state-spine active.",
|
||||
"nextSafeMove": "Accept the reviewed modeling patch.",
|
||||
"statePatch": {
|
||||
"graphFrontier": {
|
||||
"active_node_ids": ["state-spine"]
|
||||
}
|
||||
}
|
||||
}),
|
||||
};
|
||||
let response = ClientResponse::ThreadEpiphanyRoleAccept {
|
||||
request_id: RequestId::Integer(10),
|
||||
response: v2::ThreadEpiphanyRoleAcceptResponse {
|
||||
revision: 5,
|
||||
changed_fields: vec![
|
||||
v2::ThreadEpiphanyStateUpdatedField::GraphFrontier,
|
||||
v2::ThreadEpiphanyStateUpdatedField::Observations,
|
||||
v2::ThreadEpiphanyStateUpdatedField::Evidence,
|
||||
],
|
||||
epiphany_state: codex_protocol::protocol::EpiphanyThreadState {
|
||||
revision: 5,
|
||||
..Default::default()
|
||||
},
|
||||
role_id: v2::ThreadEpiphanyRoleId::Modeling,
|
||||
binding_id: "modeling-checkpoint-worker".to_string(),
|
||||
accepted_observation_id: "obs-modeling-1".to_string(),
|
||||
accepted_evidence_id: "ev-modeling-1".to_string(),
|
||||
applied_patch: patch,
|
||||
finding,
|
||||
},
|
||||
};
|
||||
|
||||
assert_eq!(response.id(), &RequestId::Integer(10));
|
||||
assert_eq!(response.method(), "thread/epiphany/roleAccept");
|
||||
assert_eq!(
|
||||
json!({
|
||||
"method": "thread/epiphany/roleAccept",
|
||||
"id": 10,
|
||||
"response": {
|
||||
"revision": 5,
|
||||
"changedFields": ["graphFrontier", "observations", "evidence"],
|
||||
"epiphanyState": {
|
||||
"revision": 5
|
||||
},
|
||||
"roleId": "modeling",
|
||||
"bindingId": "modeling-checkpoint-worker",
|
||||
"acceptedObservationId": "obs-modeling-1",
|
||||
"acceptedEvidenceId": "ev-modeling-1",
|
||||
"appliedPatch": {
|
||||
"graphFrontier": {
|
||||
"active_node_ids": ["state-spine"]
|
||||
}
|
||||
},
|
||||
"finding": {
|
||||
"roleId": "modeling",
|
||||
"verdict": "checkpoint-update-needed",
|
||||
"summary": "Graph frontier should keep state-spine active.",
|
||||
"nextSafeMove": "Accept the reviewed modeling patch.",
|
||||
"filesInspected": ["src/lib.rs"],
|
||||
"frontierNodeIds": ["state-spine"],
|
||||
"statePatch": {
|
||||
"graphFrontier": {
|
||||
"active_node_ids": ["state-spine"]
|
||||
}
|
||||
},
|
||||
"rawResult": {
|
||||
"verdict": "checkpoint-update-needed",
|
||||
"summary": "Graph frontier should keep state-spine active.",
|
||||
"nextSafeMove": "Accept the reviewed modeling patch.",
|
||||
"statePatch": {
|
||||
"graphFrontier": {
|
||||
"active_node_ids": ["state-spine"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(&response)?,
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_thread_epiphany_freshness_response() -> Result<()> {
|
||||
let response = ClientResponse::ThreadEpiphanyFreshness {
|
||||
|
|
@ -4445,6 +4563,21 @@ mod tests {
|
|||
assert_eq!(reason, Some("thread/epiphany/roleResult"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_epiphany_role_accept_is_marked_experimental() {
|
||||
let request = ClientRequest::ThreadEpiphanyRoleAccept {
|
||||
request_id: RequestId::Integer(1),
|
||||
params: v2::ThreadEpiphanyRoleAcceptParams {
|
||||
thread_id: "thr_123".to_string(),
|
||||
role_id: v2::ThreadEpiphanyRoleId::Modeling,
|
||||
expected_revision: Some(2),
|
||||
binding_id: None,
|
||||
},
|
||||
};
|
||||
let reason = crate::experimental_api::ExperimentalApi::experimental_reason(&request);
|
||||
assert_eq!(reason, Some("thread/epiphany/roleAccept"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_epiphany_freshness_is_marked_experimental() {
|
||||
let request = ClientRequest::ThreadEpiphanyFreshness {
|
||||
|
|
|
|||
|
|
@ -4002,6 +4002,7 @@ pub enum ThreadEpiphanySceneAction {
|
|||
Coordinator,
|
||||
RoleLaunch,
|
||||
RoleResult,
|
||||
RoleAccept,
|
||||
JobLaunch,
|
||||
JobInterrupt,
|
||||
Freshness,
|
||||
|
|
@ -4290,6 +4291,35 @@ pub struct ThreadEpiphanyRoleResultResponse {
|
|||
pub note: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadEpiphanyRoleAcceptParams {
|
||||
pub thread_id: String,
|
||||
pub role_id: ThreadEpiphanyRoleId,
|
||||
#[serde(default)]
|
||||
#[ts(optional = nullable)]
|
||||
pub expected_revision: Option<u64>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub binding_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadEpiphanyRoleAcceptResponse {
|
||||
pub revision: u64,
|
||||
pub changed_fields: Vec<ThreadEpiphanyStateUpdatedField>,
|
||||
pub epiphany_state: CoreEpiphanyThreadState,
|
||||
pub role_id: ThreadEpiphanyRoleId,
|
||||
pub binding_id: String,
|
||||
pub accepted_observation_id: String,
|
||||
pub accepted_evidence_id: String,
|
||||
pub applied_patch: ThreadEpiphanyUpdatePatch,
|
||||
pub finding: ThreadEpiphanyRoleFinding,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
|
|
@ -4393,6 +4423,15 @@ pub struct ThreadEpiphanyRoleFinding {
|
|||
pub frontier_node_ids: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub evidence_ids: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub open_questions: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub evidence_gaps: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub risks: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub state_patch: Option<ThreadEpiphanyUpdatePatch>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub job_error: Option<String>,
|
||||
|
|
@ -5353,6 +5392,7 @@ pub enum ThreadEpiphanyStateUpdatedSource {
|
|||
JobLaunch,
|
||||
JobInterrupt,
|
||||
ReorientAccept,
|
||||
RoleAccept,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
|
|
|
|||
|
|
@ -229,6 +229,8 @@ 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::ThreadEpiphanyRoleAcceptParams;
|
||||
use codex_app_server_protocol::ThreadEpiphanyRoleAcceptResponse;
|
||||
use codex_app_server_protocol::ThreadEpiphanyRoleFinding;
|
||||
use codex_app_server_protocol::ThreadEpiphanyRoleId;
|
||||
use codex_app_server_protocol::ThreadEpiphanyRoleLane;
|
||||
|
|
@ -1126,6 +1128,10 @@ impl CodexMessageProcessor {
|
|||
self.thread_epiphany_role_result(to_connection_request_id(request_id), params)
|
||||
.await;
|
||||
}
|
||||
ClientRequest::ThreadEpiphanyRoleAccept { request_id, params } => {
|
||||
self.thread_epiphany_role_accept(to_connection_request_id(request_id), params)
|
||||
.await;
|
||||
}
|
||||
ClientRequest::ThreadEpiphanyFreshness { request_id, params } => {
|
||||
self.thread_epiphany_freshness(to_connection_request_id(request_id), params)
|
||||
.await;
|
||||
|
|
@ -4942,6 +4948,204 @@ impl CodexMessageProcessor {
|
|||
.await;
|
||||
}
|
||||
|
||||
async fn thread_epiphany_role_accept(
|
||||
&self,
|
||||
request_id: ConnectionRequestId,
|
||||
params: ThreadEpiphanyRoleAcceptParams,
|
||||
) {
|
||||
let ThreadEpiphanyRoleAcceptParams {
|
||||
thread_id,
|
||||
role_id,
|
||||
expected_revision,
|
||||
binding_id,
|
||||
} = params;
|
||||
|
||||
if role_id != ThreadEpiphanyRoleId::Modeling {
|
||||
self.send_invalid_request_error(
|
||||
request_id,
|
||||
"only the modeling/checkpoint role currently has an Epiphany role acceptance path"
|
||||
.to_string(),
|
||||
)
|
||||
.await;
|
||||
return;
|
||||
}
|
||||
let binding_id = binding_id.unwrap_or_else(|| EPIPHANY_MODELING_ROLE_BINDING_ID.into());
|
||||
|
||||
let thread_uuid = match ThreadId::from_string(&thread_id) {
|
||||
Ok(id) => id,
|
||||
Err(err) => {
|
||||
self.send_invalid_request_error(request_id, format!("invalid thread id: {err}"))
|
||||
.await;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let loaded_thread = match self.thread_manager.get_thread(thread_uuid).await {
|
||||
Ok(thread) => thread,
|
||||
Err(_) => {
|
||||
self.send_invalid_request_error(
|
||||
request_id,
|
||||
format!("thread not loaded: {thread_uuid}"),
|
||||
)
|
||||
.await;
|
||||
return;
|
||||
}
|
||||
};
|
||||
let Some(state) = loaded_thread.epiphany_state().await else {
|
||||
self.send_invalid_request_error(
|
||||
request_id,
|
||||
"cannot accept an Epiphany role finding without authoritative Epiphany state"
|
||||
.to_string(),
|
||||
)
|
||||
.await;
|
||||
return;
|
||||
};
|
||||
if let Some(expected_revision) = expected_revision
|
||||
&& state.revision != expected_revision
|
||||
{
|
||||
self.send_invalid_request_error(
|
||||
request_id,
|
||||
format!(
|
||||
"epiphany state revision mismatch: expected {expected_revision}, found {}",
|
||||
state.revision
|
||||
),
|
||||
)
|
||||
.await;
|
||||
return;
|
||||
}
|
||||
|
||||
let finding = match load_completed_epiphany_role_finding(
|
||||
loaded_thread.as_ref(),
|
||||
&state,
|
||||
role_id,
|
||||
&binding_id,
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(finding) => finding,
|
||||
Err(CodexErr::InvalidRequest(message)) => {
|
||||
self.send_invalid_request_error(request_id, message).await;
|
||||
return;
|
||||
}
|
||||
Err(err) => {
|
||||
self.send_internal_error(
|
||||
request_id,
|
||||
format!("failed to accept Epiphany role finding: {err}"),
|
||||
)
|
||||
.await;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let mut patch = match parse_role_finding_state_patch(&finding) {
|
||||
Ok(patch) => patch,
|
||||
Err(message) => {
|
||||
self.send_invalid_request_error(request_id, message).await;
|
||||
return;
|
||||
}
|
||||
};
|
||||
let patch_errors = modeling_role_accept_patch_errors(&patch);
|
||||
if !patch_errors.is_empty() {
|
||||
self.send_invalid_request_error(
|
||||
request_id,
|
||||
format!(
|
||||
"modeling role state patch is not acceptable: {}",
|
||||
patch_errors.join("; ")
|
||||
),
|
||||
)
|
||||
.await;
|
||||
return;
|
||||
}
|
||||
|
||||
let accepted_evidence_id = format!("ev-modeling-{}", Uuid::new_v4());
|
||||
let accepted_observation_id = format!("obs-modeling-{}", Uuid::new_v4());
|
||||
let code_refs = role_finding_code_refs(&finding);
|
||||
let evidence = EpiphanyEvidenceRecord {
|
||||
id: accepted_evidence_id.clone(),
|
||||
kind: "modeling_result".to_string(),
|
||||
status: "accepted".to_string(),
|
||||
summary: role_finding_summary(&finding),
|
||||
code_refs: code_refs.clone(),
|
||||
};
|
||||
let observation = EpiphanyObservation {
|
||||
id: accepted_observation_id.clone(),
|
||||
summary: role_finding_observation_summary(&finding),
|
||||
source_kind: "modeling_result".to_string(),
|
||||
status: "accepted".to_string(),
|
||||
code_refs,
|
||||
evidence_ids: vec![accepted_evidence_id.clone()],
|
||||
};
|
||||
patch.evidence.push(evidence);
|
||||
patch.observations.push(observation);
|
||||
let changed_fields = epiphany_update_patch_changed_fields(&patch);
|
||||
let applied_patch = patch.clone();
|
||||
|
||||
let epiphany_state = match loaded_thread
|
||||
.epiphany_update_state(EpiphanyStateUpdate {
|
||||
expected_revision,
|
||||
objective: patch.objective,
|
||||
active_subgoal_id: patch.active_subgoal_id,
|
||||
subgoals: patch.subgoals,
|
||||
invariants: patch.invariants,
|
||||
graphs: patch.graphs,
|
||||
graph_frontier: patch.graph_frontier,
|
||||
graph_checkpoint: patch.graph_checkpoint,
|
||||
scratch: patch.scratch,
|
||||
investigation_checkpoint: patch.investigation_checkpoint,
|
||||
job_bindings: patch.job_bindings,
|
||||
observations: patch.observations,
|
||||
evidence: patch.evidence,
|
||||
churn: patch.churn,
|
||||
mode: patch.mode,
|
||||
})
|
||||
.await
|
||||
{
|
||||
Ok(state) => {
|
||||
client_visible_live_thread_epiphany_state(loaded_thread.as_ref(), state).await
|
||||
}
|
||||
Err(CodexErr::InvalidRequest(message)) => {
|
||||
self.send_invalid_request_error(request_id, message).await;
|
||||
return;
|
||||
}
|
||||
Err(err) => {
|
||||
self.send_internal_error(
|
||||
request_id,
|
||||
format!("failed to apply Epiphany role finding: {err}"),
|
||||
)
|
||||
.await;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
self.outgoing
|
||||
.send_response(
|
||||
request_id,
|
||||
ThreadEpiphanyRoleAcceptResponse {
|
||||
revision: epiphany_state.revision,
|
||||
changed_fields: changed_fields.clone(),
|
||||
epiphany_state: epiphany_state.clone(),
|
||||
role_id,
|
||||
binding_id: binding_id.clone(),
|
||||
accepted_observation_id,
|
||||
accepted_evidence_id,
|
||||
applied_patch,
|
||||
finding,
|
||||
},
|
||||
)
|
||||
.await;
|
||||
self.outgoing
|
||||
.send_server_notification(ServerNotification::ThreadEpiphanyStateUpdated(
|
||||
ThreadEpiphanyStateUpdatedNotification {
|
||||
thread_id: thread_uuid.to_string(),
|
||||
source: ThreadEpiphanyStateUpdatedSource::RoleAccept,
|
||||
revision: epiphany_state.revision,
|
||||
changed_fields,
|
||||
epiphany_state,
|
||||
},
|
||||
))
|
||||
.await;
|
||||
}
|
||||
|
||||
async fn thread_epiphany_freshness(
|
||||
&self,
|
||||
request_id: ConnectionRequestId,
|
||||
|
|
@ -12770,6 +12974,7 @@ fn epiphany_scene_available_actions(
|
|||
ThreadEpiphanySceneAction::Coordinator,
|
||||
ThreadEpiphanySceneAction::RoleLaunch,
|
||||
ThreadEpiphanySceneAction::RoleResult,
|
||||
ThreadEpiphanySceneAction::RoleAccept,
|
||||
ThreadEpiphanySceneAction::JobLaunch,
|
||||
ThreadEpiphanySceneAction::Freshness,
|
||||
ThreadEpiphanySceneAction::Pressure,
|
||||
|
|
@ -12990,6 +13195,10 @@ fn epiphany_role_launch_output_schema(role_id: ThreadEpiphanyRoleId) -> serde_js
|
|||
"risks": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"}
|
||||
},
|
||||
"statePatch": {
|
||||
"type": "object",
|
||||
"description": "Optional reviewable thread/epiphany/update patch. Modeling may use only graphs, graphFrontier, graphCheckpoint, scratch, investigationCheckpoint, observations, and evidence."
|
||||
}
|
||||
},
|
||||
"required": ["summary", "nextSafeMove"],
|
||||
|
|
@ -13234,6 +13443,13 @@ fn map_epiphany_role_finding(
|
|||
files_inspected: json_string_array_field(&raw_result, "filesInspected"),
|
||||
frontier_node_ids: json_string_array_field(&raw_result, "frontierNodeIds"),
|
||||
evidence_ids: json_string_array_field(&raw_result, "evidenceIds"),
|
||||
open_questions: json_string_array_field(&raw_result, "openQuestions"),
|
||||
evidence_gaps: json_string_array_field(&raw_result, "evidenceGaps"),
|
||||
risks: json_string_array_field(&raw_result, "risks"),
|
||||
state_patch: raw_result
|
||||
.get("statePatch")
|
||||
.cloned()
|
||||
.and_then(|patch| serde_json::from_value(patch).ok()),
|
||||
job_error,
|
||||
item_error,
|
||||
raw_result,
|
||||
|
|
@ -14030,6 +14246,7 @@ fn map_epiphany_roles(
|
|||
authority_scopes: vec![
|
||||
"thread/epiphany/roleLaunch".to_string(),
|
||||
"thread/epiphany/roleResult".to_string(),
|
||||
"thread/epiphany/roleAccept".to_string(),
|
||||
"thread/epiphany/update".to_string(),
|
||||
],
|
||||
recommended_action: modeling_recommended_action,
|
||||
|
|
@ -14240,6 +14457,178 @@ async fn load_completed_epiphany_reorient_finding(
|
|||
))
|
||||
}
|
||||
|
||||
async fn load_completed_epiphany_role_finding(
|
||||
thread: &CodexThread,
|
||||
state: &EpiphanyThreadState,
|
||||
role_id: ThreadEpiphanyRoleId,
|
||||
binding_id: &str,
|
||||
) -> CodexResult<ThreadEpiphanyRoleFinding> {
|
||||
let binding = state
|
||||
.job_bindings
|
||||
.iter()
|
||||
.find(|binding| binding.id == binding_id)
|
||||
.ok_or_else(|| {
|
||||
CodexErr::InvalidRequest(format!(
|
||||
"epiphany role binding {:?} was not found",
|
||||
binding_id
|
||||
))
|
||||
})?;
|
||||
let agent_job_id = binding_agent_jobs_job_id(binding).ok_or_else(|| {
|
||||
CodexErr::InvalidRequest(format!(
|
||||
"epiphany role binding {:?} is not backed by agent_jobs",
|
||||
binding_id
|
||||
))
|
||||
})?;
|
||||
let state_db_ctx = thread.epiphany_state_runtime().await.ok_or_else(|| {
|
||||
CodexErr::InvalidRequest(
|
||||
"sqlite state db is unavailable for Epiphany role result acceptance".to_string(),
|
||||
)
|
||||
})?;
|
||||
let agent_job = state_db_ctx
|
||||
.get_agent_job(agent_job_id)
|
||||
.await
|
||||
.map_err(|err| CodexErr::Fatal(format!("failed to read Epiphany backend job: {err}")))?
|
||||
.ok_or_else(|| {
|
||||
CodexErr::InvalidRequest(format!(
|
||||
"bound agent_jobs backend job {:?} was not found",
|
||||
agent_job_id
|
||||
))
|
||||
})?;
|
||||
let item = state_db_ctx
|
||||
.get_agent_job_item(agent_job_id, binding_id)
|
||||
.await
|
||||
.map_err(|err| {
|
||||
CodexErr::Fatal(format!(
|
||||
"failed to read Epiphany backend job item for {binding_id:?}: {err}"
|
||||
))
|
||||
})?
|
||||
.ok_or_else(|| {
|
||||
CodexErr::InvalidRequest(format!(
|
||||
"bound agent_jobs backend item {:?} was not found",
|
||||
binding_id
|
||||
))
|
||||
})?;
|
||||
let status = map_epiphany_role_result_status(agent_job.status, item.status);
|
||||
if status != ThreadEpiphanyRoleResultStatus::Completed {
|
||||
return Err(CodexErr::InvalidRequest(format!(
|
||||
"cannot accept role result while worker status is {:?}",
|
||||
status
|
||||
)));
|
||||
}
|
||||
let result = item.result_json.ok_or_else(|| {
|
||||
CodexErr::InvalidRequest(
|
||||
"cannot accept completed role worker because no result_json was recorded".to_string(),
|
||||
)
|
||||
})?;
|
||||
Ok(map_epiphany_role_finding(
|
||||
role_id,
|
||||
result,
|
||||
agent_job.last_error,
|
||||
item.last_error,
|
||||
))
|
||||
}
|
||||
|
||||
fn parse_role_finding_state_patch(
|
||||
finding: &ThreadEpiphanyRoleFinding,
|
||||
) -> Result<ThreadEpiphanyUpdatePatch, String> {
|
||||
let Some(value) = finding.raw_result.get("statePatch") else {
|
||||
return Err(
|
||||
"completed modeling role finding did not include a reviewable statePatch".to_string(),
|
||||
);
|
||||
};
|
||||
serde_json::from_value(value.clone())
|
||||
.map_err(|err| format!("completed modeling role finding has invalid statePatch: {err}"))
|
||||
}
|
||||
|
||||
fn modeling_role_accept_patch_errors(patch: &ThreadEpiphanyUpdatePatch) -> Vec<String> {
|
||||
let mut errors = Vec::new();
|
||||
if patch.objective.is_some() {
|
||||
errors
|
||||
.push("objective changes are not allowed through modeling role acceptance".to_string());
|
||||
}
|
||||
if patch.active_subgoal_id.is_some() || patch.subgoals.is_some() {
|
||||
errors.push("subgoal changes are not allowed through modeling role acceptance".to_string());
|
||||
}
|
||||
if patch.invariants.is_some() {
|
||||
errors
|
||||
.push("invariant changes are not allowed through modeling role acceptance".to_string());
|
||||
}
|
||||
if patch.job_bindings.is_some() {
|
||||
errors.push(
|
||||
"job binding changes are not allowed through modeling role acceptance".to_string(),
|
||||
);
|
||||
}
|
||||
if patch.churn.is_some() || patch.mode.is_some() {
|
||||
errors.push(
|
||||
"churn or mode changes are not allowed through modeling role acceptance".to_string(),
|
||||
);
|
||||
}
|
||||
if patch.graphs.is_none()
|
||||
&& patch.graph_frontier.is_none()
|
||||
&& patch.graph_checkpoint.is_none()
|
||||
&& patch.scratch.is_none()
|
||||
&& patch.investigation_checkpoint.is_none()
|
||||
{
|
||||
errors.push(
|
||||
"statePatch must include a modeling field: graphs, graphFrontier, graphCheckpoint, scratch, or investigationCheckpoint"
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
errors
|
||||
}
|
||||
|
||||
fn role_finding_summary(finding: &ThreadEpiphanyRoleFinding) -> String {
|
||||
let summary = finding
|
||||
.summary
|
||||
.clone()
|
||||
.unwrap_or_else(|| "Role worker returned a structured finding.".to_string());
|
||||
if let Some(next_safe_move) = finding.next_safe_move.as_deref() {
|
||||
format!("{summary} Next safe move: {next_safe_move}")
|
||||
} else {
|
||||
summary
|
||||
}
|
||||
}
|
||||
|
||||
fn role_finding_observation_summary(finding: &ThreadEpiphanyRoleFinding) -> String {
|
||||
let verdict = finding.verdict.as_deref().unwrap_or("unknown");
|
||||
let changed_fields = finding
|
||||
.state_patch
|
||||
.as_ref()
|
||||
.map(epiphany_update_patch_changed_fields)
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.map(|field| format!("{field:?}"))
|
||||
.collect::<Vec<_>>();
|
||||
let changed = if changed_fields.is_empty() {
|
||||
"no typed state fields projected".to_string()
|
||||
} else {
|
||||
changed_fields.join(", ")
|
||||
};
|
||||
format!(
|
||||
"Accepted {:?} role result with verdict {verdict}; projected fields: {changed}. {}",
|
||||
finding.role_id,
|
||||
role_finding_summary(finding)
|
||||
)
|
||||
}
|
||||
|
||||
fn role_finding_code_refs(finding: &ThreadEpiphanyRoleFinding) -> Vec<EpiphanyCodeRef> {
|
||||
finding
|
||||
.files_inspected
|
||||
.iter()
|
||||
.filter(|path| !path.trim().is_empty())
|
||||
.map(|path| EpiphanyCodeRef {
|
||||
path: PathBuf::from(path),
|
||||
start_line: None,
|
||||
end_line: None,
|
||||
symbol: None,
|
||||
note: Some(format!(
|
||||
"Inspected by accepted {:?} role worker.",
|
||||
finding.role_id
|
||||
)),
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn reorient_finding_summary(finding: &ThreadEpiphanyReorientFinding) -> String {
|
||||
let summary = finding
|
||||
.summary
|
||||
|
|
@ -18074,6 +18463,7 @@ mod tests {
|
|||
ThreadEpiphanySceneAction::Coordinator,
|
||||
ThreadEpiphanySceneAction::RoleLaunch,
|
||||
ThreadEpiphanySceneAction::RoleResult,
|
||||
ThreadEpiphanySceneAction::RoleAccept,
|
||||
ThreadEpiphanySceneAction::JobLaunch,
|
||||
ThreadEpiphanySceneAction::Freshness,
|
||||
ThreadEpiphanySceneAction::Pressure,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ Your job is to protect the body of the machine: architecture, data flow, seams,
|
|||
Inspect source before you trust the model; when the map feels warm but the source feels cold, believe the source and mark the wound.
|
||||
Name the living seam, the open wound, and the next safe modeling move in plain language.
|
||||
Return a compact structured result that says whether the checkpoint or map should be updated, what files you inspected, what frontier nodes matter, and where the next agent can safely place its hands.
|
||||
Do not edit files, do not implement product code, do not verify as if you were the reviewer, and do not promote your own output.
|
||||
Omit `statePatch` when no durable state change is needed. When the map, frontier, scratch, or checkpoint should change, include `statePatch`: a reviewable `thread/epiphany/update` patch using only modeling-safe fields (`graphs`, `graphFrontier`, `graphCheckpoint`, `scratch`, `investigationCheckpoint`, plus optional valid `observations` and `evidence`). Do not return an observations-only patch. Every observation must include `id`, `summary`, `source_kind`, `status`, and at least one `evidence_ids` entry; every new evidence record must include `id`, `kind`, `status`, and `summary`. For graph growth, return the full replacement graph object with the new or revised nodes/edges already woven into the current anatomy.
|
||||
Do not edit files, do not implement product code, do not verify as if you were the reviewer, do not change jobs/subgoals/objective/invariants/churn/mode, and do not promote or accept your own output.
|
||||
'''
|
||||
|
||||
verification = '''
|
||||
|
|
|
|||
Reference in a new issue