Shrink Epiphany job bindings to authority slots

This commit is contained in:
Meta Vens 2026-05-12 20:47:48 +01:00
commit bd8d5c5493
23 changed files with 55 additions and 515 deletions

View file

@ -23,7 +23,7 @@ The spine exists in more than twenty-five live paths:
- explicit state updates: app-server routes `thread/epiphany/update` through a loaded `CodexThread` update method that rejects malformed appended observation/evidence graph records and structurally invalid replacement fields, including investigation checkpoints that cite missing evidence and planning records with broken ids/source refs/backlog links/draft acceptance criteria, mutates live `SessionState` only after validation, 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:4620), [codex_thread.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/codex_thread.rs:376), [codex_thread.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/codex_thread.rs:552), [codex_thread.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/codex_thread.rs:1294), and [promotion.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/promotion.rs:44).
- 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 expose the same revision/change metadata, accepted promotions always report `Evidence` because verifier evidence is appended even when the patch evidence list is empty, and successful write response/notification states now use the same client-visible live projection as `thread/read`, including retrieval-summary backfill when durable state has no persisted retrieval metadata, in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:1113), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4354), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4419), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4428), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4555), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4608), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4652), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4693), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:11327), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:11370).
- scene projection: the `scene` view lens reads the same live/stored Epiphany state view used by `thread/read` and derives a compact client scene with objective, active subgoal, invariant status counts, graph focus/counts, retrieval status, investigation-checkpoint summary counts, observation/evidence summaries, churn, live/stored source, and available control-plane actions without mutating or persisting state.
- job/progress reflection: the `jobs` view lens reads the same thread view as scene, optionally fills retrieval state for loaded threads with no Epiphany state, and derives non-authoritative progress slots for retrieval indexing, graph remap, invariant verification, and bound specialist work. Durable `job_bindings` now act as a thin Epiphany-owned launcher seam with launcher id, authority scope, and backend job id. New bindings open matching typed runtime-spine job receipts under `state/runtime-spine.msgpack`; old `agent_jobs` bindings are sealed instead of live-crawled.
- job/progress reflection: the `jobs` view lens reads the same thread view as scene, optionally fills retrieval state for loaded threads with no Epiphany state, and derives non-authoritative progress slots for retrieval indexing, graph remap, invariant verification, and bound specialist work. Durable `job_bindings` now act as thin Epiphany-owned authority slots with binding id, kind, scope, owner role, authority scope, linked ids, and optional blocking reason only. Runtime job ids project from `runtime_links` and typed runtime-spine records; old `agent_jobs` bindings are sealed instead of live-crawled.
- bound-job progress notifications: app-server still declares experimental `thread/epiphany/jobsUpdated` as sealed legacy Codex evacuation telemetry, but the handler no longer emits Epiphany updates from old `agent_job_progress:{json}` background events. Heartbeat-owned activation and typed runtime-spine receipts are now the live Epiphany path.
- explicit job control: app-server declares experimental `thread/epiphany/jobLaunch` and `thread/epiphany/jobInterrupt`, routes them through core launch/interrupt handlers that persist heartbeat-backed durable `job_bindings` revisions through the authoritative Epiphany state path, and emit `thread/epiphany/stateUpdated` with source `jobLaunch` or `jobInterrupt` instead of creating SQLite `agent_jobs` rows or pretending jobs reflection is the scheduler.
- freshness reflection: app-server declares experimental read-only `thread/epiphany/freshness`, reads the same live/stored thread view used by the view lenses and context, fills live retrieval state for loaded threads, and derives one bounded retrieval/graph freshness lens plus, for loaded threads, watcher-backed invalidation inputs with watched root, changed paths, mapped graph-node hits, active-frontier hits, and revision/source identity without mutating, scheduling, notifying, or performing automatic semantic invalidation 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:4167), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4259), [epiphany_invalidation.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/epiphany_invalidation.rs:19), [epiphany_invalidation.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/epiphany_invalidation.rs:67), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4219), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:11073).
@ -136,7 +136,7 @@ flowchart TD
AJL --> AJLA["CodexThread.epiphany_launch_job"]
QRLQ --> QRLA["Map checkpoint + reorient verdict into fixed reorient-worker launch"]
QRLA --> AJLA
AJLA --> AJLB["Persist launcher-bound jobBinding + create backend job"]
AJLA --> AJLB["Persist authority-slot jobBinding + runtimeLink"]
AJLB --> ZD
AJI --> AJIA["CodexThread.epiphany_interrupt_job"]
AJIA --> AJIB["Interrupt backend worker(s) + clear bound backend from jobBinding"]
@ -1057,7 +1057,7 @@ The surface currently reports four base slots:
- invariant/evidence verification
- specialist work
The important boundary is that these are reflections over existing state. Retrieval status comes from the same retrieval summary machinery used by scene/thread reads. Remap pressure comes from graph frontier dirty paths, open questions/gaps, and churn freshness. Verification pressure comes from invariant status counts. Durable `jobBindings` in authoritative Epiphany state now act as a thin launcher seam: they can attach launcher id, authority scope, backend kind/job id, plus owner/scope/linkage metadata. Heartbeat-backed bindings project as pending turns until typed runtime-spine results exist; stale `agent_jobs` bindings are sealed instead of resolved through SQLite. If the runtime seam is missing or sealed, the slot blocks honestly instead of improvising a secret scheduler.
The important boundary is that these are reflections over existing state. Retrieval status comes from the same retrieval summary machinery used by scene/thread reads. Remap pressure comes from graph frontier dirty paths, open questions/gaps, and churn freshness. Verification pressure comes from invariant status counts. Durable `jobBindings` in authoritative Epiphany state now act as thin authority slots: they carry binding id, kind, owner, scope, authority scope, linked ids, and an optional blocking reason. Runtime job identity comes from `runtimeLinks` and runtime-spine records. Stale `agent_jobs` bindings are sealed instead of resolved through SQLite. If the runtime seam is missing or sealed, the slot blocks honestly instead of improvising a secret scheduler.
Protocol shape:
@ -1108,7 +1108,7 @@ The view handler:
1. returns only the base `retrieval-index`, `graph-remap`, and `verification` slots from retrieval state, frontier/churn state, and invariant counts; specialist rows appear only from explicit durable bindings/runtime links.
2. copies active subgoal and graph-node ids into relevant slots so clients can link progress pressure back to the visible model.
3. if authoritative typed state carries `jobBindings`, matches those bindings onto the base slots by id/kind or appends a bound specialist row, reflecting launcher identity, authority scope, and runtime job id.
3. if authoritative typed state carries `jobBindings`, matches those bindings onto the base slots by id/kind or appends a bound specialist row, reflecting authority scope and runtime job id from `runtimeLinks`.
4. when a binding has no runtime link or runtime job id, leaves it idle or blocked from binding state instead of inventing lifecycle.
### Output
@ -1475,7 +1475,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 lens, not the first job/progress lens, not the first freshness surface, 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 planning lens, 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 lens, not the first fixed role specialist launch/read-back templates, not the first review-gated modeling statePatch acceptance path, not the first planning synthesis lane, 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. Bound jobs reflect launcher id, authority scope, and backend job id instead of treating raw runtime pointers as the architecture; stale `agent_jobs` bindings are sealed rather than live-crawled. `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 Imagination/planning, modeling/checkpoint, and verification/review specialists over that same bounded seam, `roleResult` can read their structured outputs back without mutation, `roleAccept` can apply reviewed Imagination planning patches and reviewed modeling graph/checkpoint patches through the normal state validator, and the `crrc` view lens can recommend the next explicit action over that loop without doing the action itself. The view lenses plus role-result, role-accept, freshness, context, graphQuery, reorient-result, and MVP status surfaces give clients compact or bounded views without making the GUI/client authoritative. The remaining missing organs are automatic graph invalidation, scheduler automation if dogfood proves it is needed, and richer product ergonomics after the MVP loop has been tested by a human. GitHub Issues import is a future adapter, but it is deliberately deferred until the backlog source is fresh enough to be worth importing.
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 lens, not the first job/progress lens, not the first freshness surface, 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 planning lens, 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 lens, not the first fixed role specialist launch/read-back templates, not the first review-gated modeling statePatch acceptance path, not the first planning synthesis lane, 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. Bound jobs now keep durable binding authority separate from runtime lifecycle: `jobBindings` carry slot metadata and `runtimeLinks` carry runtime job identity. Stale `agent_jobs` bindings are sealed rather than live-crawled. `jobLaunch` / `jobInterrupt` can create or block 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 Imagination/planning, modeling/checkpoint, and verification/review specialists over that same bounded seam, `roleResult` can read their structured outputs back without mutation, `roleAccept` can apply reviewed Imagination planning patches and reviewed modeling graph/checkpoint patches through the normal state validator, and the `crrc` view lens can recommend the next explicit action over that loop without doing the action itself. The view lenses plus role-result, role-accept, freshness, context, graphQuery, reorient-result, and MVP status surfaces give clients compact or bounded views without making the GUI/client authoritative. The remaining missing organs are automatic graph invalidation, scheduler automation if dogfood proves it is needed, and richer product ergonomics after the MVP loop has been tested by a human. GitHub Issues import is a future adapter, but it is deliberately deferred until the backlog source is fresh enough to be worth importing.
```text
model/tool observations

View file

@ -36,7 +36,7 @@ remembers doctrine; the branch remembers the blade.
- Read `notes/epiphany-ideal-architecture-rebuild-plan.md` immediately after the teardown. It defines the smallest coherent replacement architecture: durable `EpiphanyState`, runtime-spine-owned `RuntimeState`, separate role memory/heartbeat state, `epiphany-core` as policy owner, app-server as adapter, Aquarium as reflector, typed acceptance receipts, and derived view lenses instead of a protocol verb zoo.
- Do not continue Aquarium UI, bridge, Face, or dogfood expansion until the teardown has a source-grounded cleanup slice plan. Epiphany is the foundation; patches on patches are not a purification rite, they are how the altar becomes load-bearing garbage.
- Phase 1 through Phase 5 are complete enough.
- Phase 6 has canonical read-only `thread/epiphany/view` lenses for scene, jobs, roles, planning, pressure, reorient, CRRC, and coordinator; separate read-only `thread/epiphany/freshness`, `thread/epiphany/context`, and `thread/epiphany/graphQuery` query surfaces; `thread/epiphany/reorientResult`; and `thread/epiphany/roleResult`. Durable `jobBindings` are now legacy launcher compatibility while new durable `runtimeLinks` hold the stable runtime-spine association. The old standalone scene/jobs/roles/planning/pressure/reorient/CRRC/coordinator read verbs have been deleted; read those projections through view lenses. New `thread/epiphany/jobLaunch`, `thread/epiphany/jobInterrupt`, `thread/epiphany/roleLaunch`, and `thread/epiphany/reorientLaunch` writes open typed runtime-spine job receipts under `state/runtime-spine.msgpack` and do not require the Codex SQLite state runtime. Freshness carries watcher-backed invalidation inputs, graphQuery traverses authoritative typed graph neighborhoods and path/symbol matches without mutation, planning projects typed captures/backlog/roadmap/objective drafts without adopting work, roles project implementation/imagination/modeling/verification/reorientation ownership from existing signals without becoming a scheduler, `roleResult` and `reorientResult` read heartbeat-backed typed runtime-spine job results through runtime links when present, and `roleAccept` / `reorientAccept` accept completed heartbeat findings by writing typed acceptance receipts while remaining explicit review gates.
- Phase 6 has canonical read-only `thread/epiphany/view` lenses for scene, jobs, roles, planning, pressure, reorient, CRRC, and coordinator; separate read-only `thread/epiphany/freshness`, `thread/epiphany/context`, and `thread/epiphany/graphQuery` query surfaces; `thread/epiphany/reorientResult`; and `thread/epiphany/roleResult`. Durable `jobBindings` are now legacy launcher compatibility slots only; they keep binding id/kind/scope/owner/authority/linkage/blocking reason while durable `runtimeLinks` hold runtime-spine job/result association. The old standalone scene/jobs/roles/planning/pressure/reorient/CRRC/coordinator read verbs have been deleted; read those projections through view lenses. New `thread/epiphany/jobLaunch`, `thread/epiphany/jobInterrupt`, `thread/epiphany/roleLaunch`, and `thread/epiphany/reorientLaunch` writes open typed runtime-spine job receipts under `state/runtime-spine.msgpack` and do not require the Codex SQLite state runtime. Freshness carries watcher-backed invalidation inputs, graphQuery traverses authoritative typed graph neighborhoods and path/symbol matches without mutation, planning projects typed captures/backlog/roadmap/objective drafts without adopting work, roles project implementation/imagination/modeling/verification/reorientation ownership from existing signals without becoming a scheduler, `roleResult` and `reorientResult` read heartbeat-backed typed runtime-spine job results through runtime links when present, and `roleAccept` / `reorientAccept` accept completed heartbeat findings by writing typed acceptance receipts while remaining explicit review gates.
- Native `epiphany-mvp-status` is the first dogfood operator view. It starts or reads a thread through app-server and prints scene, planning, pressure, reorient, jobs, roles, Imagination/modeling/verification role result read-backs, reorient result, heartbeat, Face bubbles, and CRRC recommendation as text or machine output. The old Python status module has been cut; native Rust/CultCache/CultNet surfaces are the smoked product path.
- Native `epiphany-mvp-coordinator` is the first auditable fixed-lane coordinator runner. It starts or reads a thread through app-server, opens a native runtime-spine session, follows the harness-native coordinator action, can auto-launch modeling, verification, or reorient-worker jobs, records native runtime job/result receipts for terminal launched work, keeps semantic findings review-gated by default, and writes summary, steps, rendered snapshots, transcript, stderr, runtime-spine status, and final next-action artifacts under `.epiphany-dogfood/coordinator` or a caller-provided artifact directory. It refuses direct backend-completion mutation; full completion smoke needs live workers while execution is being cauterized into CultNet.
- Native `epiphany-runtime-spine` is the first Codex-independent runtime vertebra. It owns typed CultCache documents for runtime identity, sessions, jobs, job results, and events; opens/completes native jobs; snapshots jobs/results by runtime job id; projects job-result counts; and can emit a framed CultNet hello message advertising the native document and mutation contract surface. Codex app-server launch/read-back/acceptance is now a typed heartbeat/runtime-spine bridge with no Epiphany job-result dependency on the Codex SQLite runtime.
@ -137,7 +137,7 @@ The current spine, blessed but not yet finished:
- explicit reorient-worker finding acceptance through `thread/epiphany/reorientAccept`
- read-only CRRC coordinator recommendation through the `crrc` view lens
- CRRC now recognizes already accepted reorientation findings so `reorientAccept` does not leave the operator stuck on a repeat `acceptReorientResult` recommendation.
- thin launcher metadata in durable `jobBindings`
- thin authority-slot metadata in durable `jobBindings`; runtime ids live in `runtimeLinks`
- `thread/epiphany/jobsUpdated` remains protocol shape only for sealed legacy evacuation telemetry; app-server no longer emits Epiphany updates from old runtime `agent_job_progress` events
- read-only compact reflection through the `scene` view lens
- read-only job/progress reflection through the `jobs` view lens, with durable launcher metadata and heartbeat pending projection
@ -374,10 +374,10 @@ summary-string acceptance identity is gone for live paths, launches dual-write
runtime links, result read-back prefers those runtime links, normal public
`raw_result` is sealed, MVP consumers use `thread/epiphany/view`, heartbeat
cognition is quarantined, and the old scene/jobs/roles/planning/pressure/reorient/
CRRC/coordinator read wrappers are deleted. The next cut is runtime/job lifecycle
mirror cleanup: reassess whether `jobBindings` can shrink further or be deleted
now that `runtime_links` and runtime-spine read-back own live result lookup. No
Agile confetti. No new balcony on the swaying tower.
CRRC/coordinator read wrappers are deleted, and durable `jobBindings` no longer
carry launcher/backend/progress lifecycle fields. The next pass is to audit the
plan's remaining success criteria and cut whatever still makes app-server more
than routing/adaptation. No Agile confetti. No new balcony on the swaying tower.
The Phase 6 freshness slice is landed. It exposes read-only
`thread/epiphany/freshness` from live retrieval summaries plus graph

Binary file not shown.

View file

@ -22,8 +22,8 @@ objective:
acceptance writes typed receipts keyed by runtime result id, summary-string
acceptance identity is deleted for live paths, runtime links are dual-written
on launch, and role/reorient result read-back prefers runtime links over
`jobBindings`. The next work is to shrink/delete `jobBindings` lifecycle
mirror fields, then continue endpoint/view and raw-result cleanup.
`jobBindings`. The next work is to finish the remaining rebuild success
criteria against the documented plan instead of adding outward features.
constraints:
- No frontier-scale training tithe.
@ -109,7 +109,7 @@ accepted_design:
- GUI/client work must reflect or steer typed state rather than manufacture a second throne of truth.
- The Aquarium operator UI now lives in sibling repo `E:\Projects\EpiphanyAquarium`, with its own `AGENTS.md`, `state/map.yaml`, `state/memory.json`, and interface doctrine. It remains a local Tauri v2 + React/WebGL client over EpiphanyAgent's app-server/tooling surfaces; app-server and typed Epiphany state remain authoritative.
- EpiphanyAgent no longer carries the embedded `apps/epiphany-gui` source tree. Backend artifact directories and action tools still use the historical `.epiphany-gui` contract until that backend naming seam is deliberately renamed.
- Durable `job_bindings` now form a thin Epiphany-owned launcher seam: new specialist/reorient launches write heartbeat-backed bindings with launcher identity, authority scope, backend kind, and backend job id, and open matching typed runtime-spine job receipts under `state/runtime-spine.msgpack`. Interrupt clears typed binding authority without querying the Codex SQLite runtime.
- Durable `job_bindings` now form a thin Epiphany-owned launcher seam: new specialist/reorient launches write only binding id, kind, scope, owner role, authority scope, linked ids, and an optional blocking reason. Runtime lifecycle ids live in `runtime_links` and runtime-spine job/result records, not in durable job bindings.
- The `jobs` view lens is a read-only job/progress reflection: it derives indexing, remap, verification, and specialist slots from authoritative state and retrieval summaries, then projects heartbeat-backed bindings as pending heartbeat turns. It is not the scheduler, notification stream, durable runtime job table, or SQLite reader.
- `thread/epiphany/jobsUpdated` is sealed legacy Codex evacuation telemetry. The handler no longer emits Epiphany updates from old runtime `agent_job_progress:{json}` background events; heartbeat/runtime-spine is the live activation and result path.
- `thread/epiphany/freshness` is the first read-only freshness surface: it derives retrieval and graph staleness from live retrieval summaries plus frontier/churn state, and for loaded threads reflects watcher-backed invalidation inputs with changed paths plus mapped graph/frontier hits, without mutating, scheduling, or performing automatic semantic invalidation.
@ -148,7 +148,7 @@ accepted_design:
- The old Python MVP dogfood runner has been cut. Auditable dogfood must use native coordinator/status/runtime-spine tools or a new typed Rust runner that completes heartbeat-owned runtime-spine job results.
- Epiphany safety doctrine is to separate cognition from actuation, keep authority explicit, make interruption sacred, stage capability release, and treat operator misuse as a normal design input rather than a rude hypothetical. The machine must have brakes before it receives larger engines.
- Epiphany is built in the open, but publication mode is not one-size-fits-all: use FOSS where viable, source-available licensing where economics or capability risk demand it, and commercial terms where organizations extract real enterprise value.
- `thread/epiphany/jobLaunch` and `thread/epiphany/jobInterrupt` are the first bounded authority surfaces over the thin job seam: they mutate durable `job_bindings`, queue or clear heartbeat-owned activation, and preserve explicit launcher identity and interruption without turning the `jobs` view lens into a scheduler.
- `thread/epiphany/jobLaunch` and `thread/epiphany/jobInterrupt` are the first bounded authority surfaces over the thin job seam: they mutate durable `job_bindings`, create or rely on `runtime_links` for heartbeat-owned activation, and preserve explicit interruption without turning the `jobs` view lens into a scheduler.
- Handoff, plan, harness-surface, and scratch files must have distinct jobs and must not become duplicate brains.
- A machine is perfect when every remaining part visibly deserves to exist; this applies to persistent memory too.
- Evidence is not an activity feed; repeated "I just did this" entries should be cut or distilled when git already proves the work.
@ -272,5 +272,5 @@ rejected_paths:
reason: persistent state that accumulates every local truth becomes memory cruft and weakens rehydration
current_status:
summary: Phase 1 durable state through Phase 6 coordinator/specialist/CRRC/backend organs are landed, and the May 2026 rebuild has started cutting the app-server control-plane tumor. Pressure, CRRC, coordinator, role-board, role-result interpretation/self-persistence review, and role/reorient acceptance bundle policy now live in `epiphany-core`; live duplicate-acceptance checks use runtime result receipt identity instead of summary strings; launch writes durable `runtime_links`; and role/reorient result read-back follows runtime links before falling back to legacy bindings.
next_action: Continue the teardown/rebuild migration from `notes/epiphany-ideal-architecture-rebuild-plan.md`. Landed cuts now shrink `jobBindings`, remove normal public `raw_result`, add the canonical `thread/epiphany/view` lens wrapper, migrate MVP consumers, quarantine heartbeat cognition blobs, delete the old scene/jobs/roles/planning/pressure/reorient/CRRC/coordinator read wrappers, and move pure CRRC, fixed-lane coordinator decision policy, role-board projection policy, role-result interpretation/self-persistence review policy, and role/reorient acceptance bundle policy into `epiphany-core`. The next bounded cut is runtime/job lifecycle mirror cleanup: reassess `jobBindings` now that `runtime_links` and runtime-spine result read-back own the live lifecycle. Do not resume outward Aquarium/bridge/Face/dogfood expansion until this foundation cleanup is materially farther along.
summary: Phase 1 durable state through Phase 6 coordinator/specialist/CRRC/backend organs are landed, and the May 2026 rebuild has started cutting the app-server control-plane tumor. Pressure, CRRC, coordinator, role-board, role-result interpretation/self-persistence review, and role/reorient acceptance bundle policy now live in `epiphany-core`; live duplicate-acceptance checks use runtime result receipt identity instead of summary strings; launch writes durable `runtime_links`; role/reorient result read-back follows runtime links; and `jobBindings` no longer store launcher/backend/progress lifecycle fields.
next_action: Continue the teardown/rebuild migration from `notes/epiphany-ideal-architecture-rebuild-plan.md`. Landed cuts now shrink `jobBindings`, remove normal public `raw_result`, add the canonical `thread/epiphany/view` lens wrapper, migrate MVP consumers, quarantine heartbeat cognition blobs, delete the old scene/jobs/roles/planning/pressure/reorient/CRRC/coordinator read wrappers, and move pure CRRC, fixed-lane coordinator decision policy, role-board projection policy, role-result interpretation/self-persistence review policy, and role/reorient acceptance bundle policy into `epiphany-core`. The next pass is to audit the plan's remaining success criteria and cut whatever still makes app-server more than routing/adaptation. Do not resume outward Aquarium/bridge/Face/dogfood expansion until this foundation cleanup is complete enough to defend.

View file

@ -1315,12 +1315,6 @@
"null"
]
},
"backend_job_id": {
"type": [
"string",
"null"
]
},
"blocking_reason": {
"type": [
"string",
@ -1333,12 +1327,6 @@
"kind": {
"$ref": "#/definitions/EpiphanyJobKind"
},
"launcher_job_id": {
"type": [
"string",
"null"
]
},
"linked_graph_node_ids": {
"items": {
"type": "string"
@ -1354,12 +1342,6 @@
"owner_role": {
"type": "string"
},
"progress_note": {
"type": [
"string",
"null"
]
},
"scope": {
"type": "string"
}

View file

@ -1575,12 +1575,6 @@
"null"
]
},
"backend_job_id": {
"type": [
"string",
"null"
]
},
"blocking_reason": {
"type": [
"string",
@ -1593,12 +1587,6 @@
"kind": {
"$ref": "#/definitions/EpiphanyJobKind"
},
"launcher_job_id": {
"type": [
"string",
"null"
]
},
"linked_graph_node_ids": {
"items": {
"type": "string"
@ -1614,12 +1602,6 @@
"owner_role": {
"type": "string"
},
"progress_note": {
"type": [
"string",
"null"
]
},
"scope": {
"type": "string"
}

View file

@ -8444,12 +8444,6 @@
"null"
]
},
"backend_job_id": {
"type": [
"string",
"null"
]
},
"blocking_reason": {
"type": [
"string",
@ -8462,12 +8456,6 @@
"kind": {
"$ref": "#/definitions/v2/EpiphanyJobKind"
},
"launcher_job_id": {
"type": [
"string",
"null"
]
},
"linked_graph_node_ids": {
"items": {
"type": "string"
@ -8483,12 +8471,6 @@
"owner_role": {
"type": "string"
},
"progress_note": {
"type": [
"string",
"null"
]
},
"scope": {
"type": "string"
}

View file

@ -4984,12 +4984,6 @@
"null"
]
},
"backend_job_id": {
"type": [
"string",
"null"
]
},
"blocking_reason": {
"type": [
"string",
@ -5002,12 +4996,6 @@
"kind": {
"$ref": "#/definitions/EpiphanyJobKind"
},
"launcher_job_id": {
"type": [
"string",
"null"
]
},
"linked_graph_node_ids": {
"items": {
"type": "string"
@ -5023,12 +5011,6 @@
"owner_role": {
"type": "string"
},
"progress_note": {
"type": [
"string",
"null"
]
},
"scope": {
"type": "string"
}

View file

@ -574,12 +574,6 @@
"null"
]
},
"backend_job_id": {
"type": [
"string",
"null"
]
},
"blocking_reason": {
"type": [
"string",
@ -592,12 +586,6 @@
"kind": {
"$ref": "#/definitions/EpiphanyJobKind"
},
"launcher_job_id": {
"type": [
"string",
"null"
]
},
"linked_graph_node_ids": {
"items": {
"type": "string"
@ -613,12 +601,6 @@
"owner_role": {
"type": "string"
},
"progress_note": {
"type": [
"string",
"null"
]
},
"scope": {
"type": "string"
}

View file

@ -1022,12 +1022,6 @@
"null"
]
},
"backend_job_id": {
"type": [
"string",
"null"
]
},
"blocking_reason": {
"type": [
"string",
@ -1040,12 +1034,6 @@
"kind": {
"$ref": "#/definitions/EpiphanyJobKind"
},
"launcher_job_id": {
"type": [
"string",
"null"
]
},
"linked_graph_node_ids": {
"items": {
"type": "string"
@ -1061,12 +1049,6 @@
"owner_role": {
"type": "string"
},
"progress_note": {
"type": [
"string",
"null"
]
},
"scope": {
"type": "string"
}

View file

@ -963,12 +963,6 @@
"null"
]
},
"backend_job_id": {
"type": [
"string",
"null"
]
},
"blocking_reason": {
"type": [
"string",
@ -981,12 +975,6 @@
"kind": {
"$ref": "#/definitions/EpiphanyJobKind"
},
"launcher_job_id": {
"type": [
"string",
"null"
]
},
"linked_graph_node_ids": {
"items": {
"type": "string"
@ -1002,12 +990,6 @@
"owner_role": {
"type": "string"
},
"progress_note": {
"type": [
"string",
"null"
]
},
"scope": {
"type": "string"
}

View file

@ -963,12 +963,6 @@
"null"
]
},
"backend_job_id": {
"type": [
"string",
"null"
]
},
"blocking_reason": {
"type": [
"string",
@ -981,12 +975,6 @@
"kind": {
"$ref": "#/definitions/EpiphanyJobKind"
},
"launcher_job_id": {
"type": [
"string",
"null"
]
},
"linked_graph_node_ids": {
"items": {
"type": "string"
@ -1002,12 +990,6 @@
"owner_role": {
"type": "string"
},
"progress_note": {
"type": [
"string",
"null"
]
},
"scope": {
"type": "string"
}

View file

@ -963,12 +963,6 @@
"null"
]
},
"backend_job_id": {
"type": [
"string",
"null"
]
},
"blocking_reason": {
"type": [
"string",
@ -981,12 +975,6 @@
"kind": {
"$ref": "#/definitions/EpiphanyJobKind"
},
"launcher_job_id": {
"type": [
"string",
"null"
]
},
"linked_graph_node_ids": {
"items": {
"type": "string"
@ -1002,12 +990,6 @@
"owner_role": {
"type": "string"
},
"progress_note": {
"type": [
"string",
"null"
]
},
"scope": {
"type": "string"
}

View file

@ -1022,12 +1022,6 @@
"null"
]
},
"backend_job_id": {
"type": [
"string",
"null"
]
},
"blocking_reason": {
"type": [
"string",
@ -1040,12 +1034,6 @@
"kind": {
"$ref": "#/definitions/EpiphanyJobKind"
},
"launcher_job_id": {
"type": [
"string",
"null"
]
},
"linked_graph_node_ids": {
"items": {
"type": "string"
@ -1061,12 +1049,6 @@
"owner_role": {
"type": "string"
},
"progress_note": {
"type": [
"string",
"null"
]
},
"scope": {
"type": "string"
}

View file

@ -963,12 +963,6 @@
"null"
]
},
"backend_job_id": {
"type": [
"string",
"null"
]
},
"blocking_reason": {
"type": [
"string",
@ -981,12 +975,6 @@
"kind": {
"$ref": "#/definitions/EpiphanyJobKind"
},
"launcher_job_id": {
"type": [
"string",
"null"
]
},
"linked_graph_node_ids": {
"items": {
"type": "string"
@ -1002,12 +990,6 @@
"owner_role": {
"type": "string"
},
"progress_note": {
"type": [
"string",
"null"
]
},
"scope": {
"type": "string"
}

View file

@ -1022,12 +1022,6 @@
"null"
]
},
"backend_job_id": {
"type": [
"string",
"null"
]
},
"blocking_reason": {
"type": [
"string",
@ -1040,12 +1034,6 @@
"kind": {
"$ref": "#/definitions/EpiphanyJobKind"
},
"launcher_job_id": {
"type": [
"string",
"null"
]
},
"linked_graph_node_ids": {
"items": {
"type": "string"
@ -1061,12 +1049,6 @@
"owner_role": {
"type": "string"
},
"progress_note": {
"type": [
"string",
"null"
]
},
"scope": {
"type": "string"
}

View file

@ -963,12 +963,6 @@
"null"
]
},
"backend_job_id": {
"type": [
"string",
"null"
]
},
"blocking_reason": {
"type": [
"string",
@ -981,12 +975,6 @@
"kind": {
"$ref": "#/definitions/EpiphanyJobKind"
},
"launcher_job_id": {
"type": [
"string",
"null"
]
},
"linked_graph_node_ids": {
"items": {
"type": "string"
@ -1002,12 +990,6 @@
"owner_role": {
"type": "string"
},
"progress_note": {
"type": [
"string",
"null"
]
},
"scope": {
"type": "string"
}

View file

@ -963,12 +963,6 @@
"null"
]
},
"backend_job_id": {
"type": [
"string",
"null"
]
},
"blocking_reason": {
"type": [
"string",
@ -981,12 +975,6 @@
"kind": {
"$ref": "#/definitions/EpiphanyJobKind"
},
"launcher_job_id": {
"type": [
"string",
"null"
]
},
"linked_graph_node_ids": {
"items": {
"type": "string"
@ -1002,12 +990,6 @@
"owner_role": {
"type": "string"
},
"progress_note": {
"type": [
"string",
"null"
]
},
"scope": {
"type": "string"
}

View file

@ -3,4 +3,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { EpiphanyJobKind } from "./EpiphanyJobKind";
export type EpiphanyJobBinding = { id: string, kind: EpiphanyJobKind, scope: string, owner_role: string, launcher_job_id?: string | null, authority_scope?: string | null, backend_job_id?: string | null, linked_subgoal_ids?: Array<string>, linked_graph_node_ids?: Array<string>, progress_note?: string | null, blocking_reason?: string | null, };
export type EpiphanyJobBinding = { id: string, kind: EpiphanyJobKind, scope: string, owner_role: string, authority_scope?: string | null, linked_subgoal_ids?: Array<string>, linked_graph_node_ids?: Array<string>, blocking_reason?: string | null, };

View file

@ -1724,15 +1724,9 @@ mod tests {
kind: codex_protocol::protocol::EpiphanyJobKind::Specialist,
scope: "role-scoped modeling/checkpoint maintenance".to_string(),
owner_role: "epiphany-modeler".to_string(),
launcher_job_id: Some("epiphany-launch-1".to_string()),
authority_scope: Some("epiphany.role.modeling".to_string()),
backend_job_id: Some("backend-1".to_string()),
linked_subgoal_ids: vec!["phase-6".to_string()],
linked_graph_node_ids: vec!["state-spine".to_string()],
progress_note: Some(
"Explicitly launched through the Epiphany authority surface onto the heartbeat backend."
.to_string(),
),
blocking_reason: None,
}],
..Default::default()
@ -1779,12 +1773,9 @@ mod tests {
"kind": "specialist",
"scope": "role-scoped modeling/checkpoint maintenance",
"owner_role": "epiphany-modeler",
"launcher_job_id": "epiphany-launch-1",
"authority_scope": "epiphany.role.modeling",
"backend_job_id": "backend-1",
"linked_subgoal_ids": ["phase-6"],
"linked_graph_node_ids": ["state-spine"],
"progress_note": "Explicitly launched through the Epiphany authority surface onto the heartbeat backend."
"linked_graph_node_ids": ["state-spine"]
}]
},
"job": {
@ -2367,15 +2358,9 @@ mod tests {
kind: codex_protocol::protocol::EpiphanyJobKind::Specialist,
scope: "reorient-guided checkpoint regather".to_string(),
owner_role: "epiphany-reorient".to_string(),
launcher_job_id: Some("epiphany-launch-1".to_string()),
authority_scope: Some("epiphany.reorient.regather".to_string()),
backend_job_id: Some("backend-1".to_string()),
linked_subgoal_ids: vec!["phase-6".to_string()],
linked_graph_node_ids: vec!["state-spine".to_string()],
progress_note: Some(
"Explicitly launched through the Epiphany authority surface onto the heartbeat backend."
.to_string(),
),
blocking_reason: None,
}],
..Default::default()
@ -2442,12 +2427,9 @@ mod tests {
"kind": "specialist",
"scope": "reorient-guided checkpoint regather",
"owner_role": "epiphany-reorient",
"launcher_job_id": "epiphany-launch-1",
"authority_scope": "epiphany.reorient.regather",
"backend_job_id": "backend-1",
"linked_subgoal_ids": ["phase-6"],
"linked_graph_node_ids": ["state-spine"],
"progress_note": "Explicitly launched through the Epiphany authority surface onto the heartbeat backend."
"linked_graph_node_ids": ["state-spine"]
}]
},
"job": {
@ -2955,12 +2937,9 @@ mod tests {
kind: codex_protocol::protocol::EpiphanyJobKind::Specialist,
scope: "role-scoped specialist work".to_string(),
owner_role: "epiphany-harness".to_string(),
launcher_job_id: None,
authority_scope: Some("epiphany.specialist".to_string()),
backend_job_id: None,
linked_subgoal_ids: Vec::new(),
linked_graph_node_ids: Vec::new(),
progress_note: None,
blocking_reason: None,
}],
runtime_links: vec![codex_protocol::protocol::EpiphanyRuntimeLink {
@ -3057,12 +3036,9 @@ mod tests {
kind: codex_protocol::protocol::EpiphanyJobKind::Specialist,
scope: "role-scoped specialist work".to_string(),
owner_role: "epiphany-harness".to_string(),
launcher_job_id: None,
authority_scope: Some("epiphany.specialist".to_string()),
backend_job_id: None,
linked_subgoal_ids: Vec::new(),
linked_graph_node_ids: Vec::new(),
progress_note: None,
blocking_reason: Some(
"Launch explicitly to resume specialist work.".to_string(),
),

View file

@ -13569,25 +13569,6 @@ fn load_epiphany_role_result_from_runtime_spine_job(
(status, finding, note)
}
fn load_epiphany_role_result_from_runtime_spine(
binding: &EpiphanyJobBinding,
runtime_store_path: Option<&Path>,
role_id: ThreadEpiphanyRoleId,
) -> (
ThreadEpiphanyRoleResultStatus,
Option<ThreadEpiphanyRoleFinding>,
String,
) {
let Some(job_id) = binding_backend_job_id(binding) else {
return (
ThreadEpiphanyRoleResultStatus::BackendMissing,
None,
"Heartbeat binding has no runtime-spine job id.".to_string(),
);
};
load_epiphany_role_result_from_runtime_spine_job(job_id, runtime_store_path, role_id)
}
fn load_epiphany_reorient_result_from_runtime_spine_job(
job_id: &str,
runtime_store_path: Option<&Path>,
@ -13635,24 +13616,6 @@ fn load_epiphany_reorient_result_from_runtime_spine_job(
(status, finding, note)
}
fn load_epiphany_reorient_result_from_runtime_spine(
binding: &EpiphanyJobBinding,
runtime_store_path: Option<&Path>,
) -> (
ThreadEpiphanyReorientResultStatus,
Option<ThreadEpiphanyReorientFinding>,
String,
) {
let Some(job_id) = binding_backend_job_id(binding) else {
return (
ThreadEpiphanyReorientResultStatus::BackendMissing,
None,
"Heartbeat binding has no runtime-spine job id.".to_string(),
);
};
load_epiphany_reorient_result_from_runtime_spine_job(job_id, runtime_store_path)
}
fn map_runtime_role_result_status(
snapshot: &EpiphanyRuntimeJobSnapshot,
) -> ThreadEpiphanyRoleResultStatus {
@ -13736,19 +13699,16 @@ async fn load_epiphany_role_result_snapshot(
);
}
let Some(binding) = state
if !state
.job_bindings
.iter()
.find(|binding| binding.id == binding_id)
else {
.any(|binding| binding.id == binding_id)
{
return (
ThreadEpiphanyRoleResultStatus::MissingBinding,
None,
"No matching Epiphany role specialist binding exists.".to_string(),
);
};
if binding_backend_job_id(binding).is_some() {
return load_epiphany_role_result_from_runtime_spine(binding, runtime_store_path, role_id);
}
(
ThreadEpiphanyRoleResultStatus::BackendUnavailable,
@ -13780,19 +13740,16 @@ async fn load_epiphany_reorient_result_snapshot(
);
}
let Some(binding) = state
if !state
.job_bindings
.iter()
.find(|binding| binding.id == binding_id)
else {
.any(|binding| binding.id == binding_id)
{
return (
ThreadEpiphanyReorientResultStatus::MissingBinding,
None,
"No matching Epiphany reorientation worker binding exists.".to_string(),
);
};
if binding_backend_job_id(binding).is_some() {
return load_epiphany_reorient_result_from_runtime_spine(binding, runtime_store_path);
}
(
ThreadEpiphanyReorientResultStatus::BackendUnavailable,
@ -14693,29 +14650,15 @@ async fn load_completed_epiphany_reorient_finding(
});
}
if let Some(binding) = state
if !state
.job_bindings
.iter()
.find(|binding| binding.id == binding_id)
&& binding_backend_job_id(binding).is_some()
.any(|binding| binding.id == binding_id)
{
let runtime_store_path = thread.epiphany_runtime_spine_store_path().await;
let (status, finding, _note) = load_epiphany_reorient_result_from_runtime_spine(
binding,
Some(runtime_store_path.as_path()),
);
if status != ThreadEpiphanyReorientResultStatus::Completed {
return Err(CodexErr::InvalidRequest(format!(
"cannot accept reorientation result while worker status is {:?}",
status
)));
}
return finding.ok_or_else(|| {
CodexErr::InvalidRequest(
"cannot accept completed reorientation worker because no typed runtime-spine result was recorded"
.to_string(),
)
});
return Err(CodexErr::InvalidRequest(format!(
"epiphany reorientation binding {:?} was not found",
binding_id
)));
}
Err(CodexErr::InvalidRequest(
@ -14751,35 +14694,15 @@ async fn load_completed_epiphany_role_finding(
});
}
let binding = state
if !state
.job_bindings
.iter()
.find(|binding| binding.id == binding_id)
.ok_or_else(|| {
CodexErr::InvalidRequest(format!(
"epiphany role binding {:?} was not found",
binding_id
))
})?;
if binding_backend_job_id(binding).is_some() {
let runtime_store_path = thread.epiphany_runtime_spine_store_path().await;
let (status, finding, _note) = load_epiphany_role_result_from_runtime_spine(
binding,
Some(runtime_store_path.as_path()),
role_id,
);
if status != ThreadEpiphanyRoleResultStatus::Completed {
return Err(CodexErr::InvalidRequest(format!(
"cannot accept role result while worker status is {:?}",
status
)));
}
return finding.ok_or_else(|| {
CodexErr::InvalidRequest(
"cannot accept completed role worker because no typed runtime-spine result was recorded"
.to_string(),
)
});
.any(|binding| binding.id == binding_id)
{
return Err(CodexErr::InvalidRequest(format!(
"epiphany role binding {:?} was not found",
binding_id
)));
}
Err(CodexErr::InvalidRequest(
@ -16250,14 +16173,6 @@ fn extend_unique_strings(target: &mut Vec<String>, values: impl IntoIterator<Ite
}
}
fn binding_launcher_job_id(binding: &EpiphanyJobBinding) -> Option<&str> {
binding.launcher_job_id.as_deref()
}
fn binding_backend_job_id(binding: &EpiphanyJobBinding) -> Option<&str> {
binding.backend_job_id.as_deref()
}
pub(crate) async fn maybe_run_epiphany_coordinator_automation_for_turn_boundary(
thread_id: ThreadId,
thread: Arc<CodexThread>,
@ -16551,11 +16466,9 @@ fn map_epiphany_bound_job(
kind: map_core_epiphany_job_kind(binding.kind),
scope: binding.scope.clone(),
owner_role: binding.owner_role.clone(),
launcher_job_id: binding_launcher_job_id(binding).map(str::to_string),
launcher_job_id: None,
authority_scope: binding.authority_scope.clone(),
backend_job_id: runtime_link
.map(|link| link.runtime_job_id.clone())
.or_else(|| binding_projected_backend_job_id(binding).map(str::to_string)),
backend_job_id: runtime_link.map(|link| link.runtime_job_id.clone()),
status: if binding.blocking_reason.is_some() {
ThreadEpiphanyJobStatus::Blocked
} else {
@ -16583,20 +16496,15 @@ fn overlay_epiphany_job_binding(
job.kind = map_core_epiphany_job_kind(binding.kind);
job.scope = binding.scope.clone();
job.owner_role = binding.owner_role.clone();
job.launcher_job_id = binding_launcher_job_id(binding).map(str::to_string);
job.launcher_job_id = None;
job.authority_scope = binding.authority_scope.clone();
job.backend_job_id = runtime_link
.map(|link| link.runtime_job_id.clone())
.or_else(|| binding_projected_backend_job_id(binding).map(str::to_string));
job.backend_job_id = runtime_link.map(|link| link.runtime_job_id.clone());
if !binding.linked_subgoal_ids.is_empty() {
job.linked_subgoal_ids = binding.linked_subgoal_ids.clone();
}
if !binding.linked_graph_node_ids.is_empty() {
job.linked_graph_node_ids = binding.linked_graph_node_ids.clone();
}
if let Some(progress_note) = binding.progress_note.clone() {
job.progress_note = Some(progress_note);
}
if let Some(blocking_reason) = binding.blocking_reason.clone() {
job.blocking_reason = Some(blocking_reason);
}
@ -16605,25 +16513,17 @@ fn overlay_epiphany_job_binding(
return job;
}
if runtime_link.is_some() || binding_backend_job_id(binding).is_some() {
if runtime_link.is_some() {
job.status = ThreadEpiphanyJobStatus::Pending;
job.blocking_reason = None;
job.progress_note = Some(
binding
.progress_note
.clone()
.unwrap_or_else(|| "Queued for Epiphany heartbeat activation.".to_string()),
);
job.progress_note =
Some("Queued for Epiphany heartbeat activation through runtime_links.".to_string());
return job;
}
job
}
fn binding_projected_backend_job_id(binding: &EpiphanyJobBinding) -> Option<&str> {
binding_backend_job_id(binding)
}
fn map_core_epiphany_job_kind(kind: CoreEpiphanyJobKind) -> ThreadEpiphanyJobKind {
match kind {
CoreEpiphanyJobKind::Indexing => ThreadEpiphanyJobKind::Indexing,
@ -18980,12 +18880,9 @@ mod tests {
kind: codex_protocol::protocol::EpiphanyJobKind::Specialist,
scope: "reorient-guided checkpoint resume".to_string(),
owner_role: EPIPHANY_REORIENT_OWNER_ROLE.to_string(),
launcher_job_id: Some("launcher-1".to_string()),
authority_scope: Some("epiphany.reorient.resume".to_string()),
backend_job_id: Some("backend-1".to_string()),
linked_subgoal_ids: Vec::new(),
linked_graph_node_ids: Vec::new(),
progress_note: None,
blocking_reason: None,
}],
..Default::default()
@ -21641,12 +21538,9 @@ mod tests {
kind: codex_protocol::protocol::EpiphanyJobKind::Specialist,
scope: "role-scoped modeling/checkpoint maintenance".to_string(),
owner_role: "epiphany-modeler".to_string(),
launcher_job_id: None,
authority_scope: Some("epiphany.role.modeling".to_string()),
backend_job_id: None,
linked_subgoal_ids: vec!["phase-6".to_string()],
linked_graph_node_ids: vec!["runtime-spine".to_string()],
progress_note: None,
blocking_reason: None,
}],
runtime_links: vec![codex_protocol::protocol::EpiphanyRuntimeLink {
@ -21733,21 +21627,8 @@ mod tests {
)
.expect("runtime result");
let binding = codex_protocol::protocol::EpiphanyJobBinding {
id: "modeling-checkpoint-worker".to_string(),
kind: codex_protocol::protocol::EpiphanyJobKind::Specialist,
scope: "role-scoped modeling/checkpoint maintenance".to_string(),
owner_role: "epiphany-modeler".to_string(),
launcher_job_id: Some("epiphany-heartbeat-launch-1".to_string()),
authority_scope: Some("epiphany.role.modeling".to_string()),
backend_job_id: Some("heartbeat-job-1".to_string()),
linked_subgoal_ids: Vec::new(),
linked_graph_node_ids: Vec::new(),
progress_note: None,
blocking_reason: None,
};
let (status, finding, note) = load_epiphany_role_result_from_runtime_spine(
&binding,
let (status, finding, note) = load_epiphany_role_result_from_runtime_spine_job(
"heartbeat-job-1",
Some(store.as_path()),
ThreadEpiphanyRoleId::Modeling,
);
@ -21768,12 +21649,9 @@ mod tests {
kind: codex_protocol::protocol::EpiphanyJobKind::Specialist,
scope: "role-scoped specialist work".to_string(),
owner_role: "epiphany-harness".to_string(),
launcher_job_id: None,
authority_scope: Some("epiphany.specialist".to_string()),
backend_job_id: None,
linked_subgoal_ids: vec!["phase-6".to_string()],
linked_graph_node_ids: vec!["job-control".to_string()],
progress_note: None,
blocking_reason: Some(
"No active runtime backend is currently bound; launch explicitly to resume specialist work."
.to_string(),

View file

@ -522,11 +522,7 @@ impl CodexThread {
&request,
backend_job_id.as_str(),
)?;
let replacement_binding = build_epiphany_job_launch_binding(
&request,
launcher_job_id.as_str(),
backend_job_id.as_str(),
);
let replacement_binding = build_epiphany_job_launch_binding(&request);
let replacement_runtime_link =
build_epiphany_runtime_link(&request, backend_job_id.as_str());
let next_job_bindings = replace_or_append_epiphany_job_binding(
@ -834,22 +830,15 @@ fn validate_epiphany_job_launch_target(
Ok(())
}
fn build_epiphany_job_launch_binding(
request: &EpiphanyJobLaunchRequest,
_launcher_job_id: &str,
_backend_job_id: &str,
) -> EpiphanyJobBinding {
fn build_epiphany_job_launch_binding(request: &EpiphanyJobLaunchRequest) -> EpiphanyJobBinding {
EpiphanyJobBinding {
id: request.binding_id.clone(),
kind: request.kind,
scope: request.scope.clone(),
owner_role: request.owner_role.clone(),
launcher_job_id: None,
authority_scope: Some(request.authority_scope.clone()),
backend_job_id: None,
linked_subgoal_ids: request.linked_subgoal_ids.clone(),
linked_graph_node_ids: request.linked_graph_node_ids.clone(),
progress_note: None,
blocking_reason: None,
}
}
@ -956,9 +945,6 @@ fn clear_epiphany_job_binding_backend(
blocking_reason: &str,
) -> Vec<EpiphanyJobBinding> {
let binding = &mut bindings[binding_index];
binding.launcher_job_id = None;
binding.backend_job_id = None;
binding.progress_note = None;
binding.blocking_reason = Some(blocking_reason.to_string());
bindings
}
@ -1178,19 +1164,9 @@ fn validate_epiphany_job_bindings(job_bindings: &[EpiphanyJobBinding]) -> Vec<St
require_nonempty_update(&binding.id, "job_binding.id", &mut errors);
require_nonempty_update(&binding.scope, "job_binding.scope", &mut errors);
require_nonempty_update(&binding.owner_role, "job_binding.owner_role", &mut errors);
if let Some(launcher_job_id) = binding.launcher_job_id.as_deref() {
require_nonempty_update(launcher_job_id, "job_binding.launcher_job_id", &mut errors);
}
if let Some(authority_scope) = binding.authority_scope.as_deref() {
require_nonempty_update(authority_scope, "job_binding.authority_scope", &mut errors);
}
if let Some(backend_job_id) = binding.backend_job_id.as_deref() {
require_nonempty_update(backend_job_id, "job_binding.backend_job_id", &mut errors);
}
if let Some(progress_note) = binding.progress_note.as_deref() {
require_nonempty_update(progress_note, "job_binding.progress_note", &mut errors);
}
if let Some(blocking_reason) = binding.blocking_reason.as_deref() {
require_nonempty_update(blocking_reason, "job_binding.blocking_reason", &mut errors);
}
@ -1510,12 +1486,9 @@ mod epiphany_update_tests {
kind: EpiphanyJobKind::Specialist,
scope: "role-scoped specialist work".to_string(),
owner_role: "epiphany-harness".to_string(),
launcher_job_id: Some(format!("launcher-{id}")),
authority_scope: Some("epiphany.specialist".to_string()),
backend_job_id: Some(format!("heartbeat-job-{id}")),
linked_subgoal_ids: vec!["phase-6".to_string()],
linked_graph_node_ids: vec!["job-surface".to_string()],
progress_note: Some("Bound to a heartbeat runtime-spine job.".to_string()),
blocking_reason: None,
}
}
@ -1625,18 +1598,10 @@ mod epiphany_update_tests {
assert_eq!(state.revision, 3);
assert_eq!(state.job_bindings.len(), 1);
assert_eq!(state.job_bindings[0].id, "new");
assert_eq!(
state.job_bindings[0].launcher_job_id.as_deref(),
Some("launcher-new")
);
assert_eq!(
state.job_bindings[0].authority_scope.as_deref(),
Some("epiphany.specialist")
);
assert_eq!(
state.job_bindings[0].backend_job_id.as_deref(),
Some("heartbeat-job-new")
);
assert_eq!(state.last_updated_turn_id.as_deref(), Some("turn-jobs"));
}
@ -1999,12 +1964,9 @@ mod epiphany_update_tests {
kind: EpiphanyJobKind::Verification,
scope: String::new(),
owner_role: String::new(),
launcher_job_id: Some(String::new()),
authority_scope: Some(String::new()),
backend_job_id: Some(String::new()),
linked_subgoal_ids: Vec::new(),
linked_graph_node_ids: Vec::new(),
progress_note: Some(String::new()),
blocking_reason: Some(String::new()),
},
]),
@ -2034,26 +1996,11 @@ mod epiphany_update_tests {
.iter()
.any(|error| error.contains("job_binding.owner_role must not be empty"))
);
assert!(
errors
.iter()
.any(|error| error.contains("job_binding.launcher_job_id must not be empty"))
);
assert!(
errors
.iter()
.any(|error| error.contains("job_binding.authority_scope must not be empty"))
);
assert!(
errors
.iter()
.any(|error| error.contains("job_binding.backend_job_id must not be empty"))
);
assert!(
errors
.iter()
.any(|error| error.contains("job_binding.progress_note must not be empty"))
);
assert!(
errors
.iter()
@ -2078,13 +2025,13 @@ mod epiphany_update_tests {
max_runtime_seconds: Some(60),
};
let binding =
build_epiphany_job_launch_binding(&request, "epiphany-heartbeat-launch-1", "turn-1");
let binding = build_epiphany_job_launch_binding(&request);
let runtime_link = build_epiphany_runtime_link(&request, "turn-1");
assert_eq!(binding.launcher_job_id, None);
assert_eq!(binding.backend_job_id, None);
assert_eq!(binding.progress_note, None);
assert_eq!(
binding.authority_scope.as_deref(),
Some("epiphany.role.modeling")
);
assert_eq!(
runtime_link.id,
"runtime-link-modeling-checkpoint-worker-turn-1"

View file

@ -3364,13 +3364,7 @@ pub struct EpiphanyJobBinding {
pub owner_role: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(type = "string | null")]
pub launcher_job_id: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(type = "string | null")]
pub authority_scope: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(type = "string | null")]
pub backend_job_id: Option<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
#[ts(type = "Array<string>")]
pub linked_subgoal_ids: Vec<String>,
@ -3379,9 +3373,6 @@ pub struct EpiphanyJobBinding {
pub linked_graph_node_ids: Vec<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(type = "string | null")]
pub progress_note: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(type = "string | null")]
pub blocking_reason: Option<String>,
}