From c66695eefc4d1de5ef81b62e1b86a2b8e4376fb5 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 26 Apr 2026 15:58:18 +0100 Subject: [PATCH] Add Epiphany thin job launcher seam --- README.md | 1 + notes/epiphany-core-harness-surfaces.md | 34 ++-- notes/epiphany-current-algorithmic-map.md | 30 +-- notes/epiphany-fork-implementation-plan.md | 9 +- notes/fresh-workspace-handoff.md | 15 +- state/evidence.jsonl | 2 + state/map.yaml | 13 +- tools/epiphany_phase6_jobs_smoke.py | 32 +++ .../schema/json/ClientRequest.json | 34 ++++ .../schema/json/ServerNotification.json | 68 +++++++ .../codex_app_server_protocol.schemas.json | 68 +++++++ .../codex_app_server_protocol.v2.schemas.json | 68 +++++++ ...ThreadEpiphanyJobsUpdatedNotification.json | 34 ++++ ...hreadEpiphanyStateUpdatedNotification.json | 34 ++++ .../schema/json/v2/ThreadForkResponse.json | 34 ++++ .../schema/json/v2/ThreadListResponse.json | 34 ++++ .../json/v2/ThreadMetadataUpdateResponse.json | 34 ++++ .../schema/json/v2/ThreadReadResponse.json | 34 ++++ .../schema/json/v2/ThreadResumeResponse.json | 34 ++++ .../json/v2/ThreadRollbackResponse.json | 34 ++++ .../schema/json/v2/ThreadStartResponse.json | 34 ++++ .../json/v2/ThreadStartedNotification.json | 34 ++++ .../json/v2/ThreadUnarchiveResponse.json | 34 ++++ .../schema/typescript/EpiphanyJobBinding.ts | 2 +- .../schema/typescript/v2/ThreadEpiphanyJob.ts | 3 +- .../v2/ThreadEpiphanyJobBackendKind.ts | 5 + .../schema/typescript/v2/index.ts | 1 + .../src/protocol/common.rs | 16 ++ .../app-server-protocol/src/protocol/v2.rs | 19 ++ vendor/codex/codex-rs/app-server/README.md | 2 +- .../app-server/src/bespoke_event_handling.rs | 15 +- .../app-server/src/codex_message_processor.rs | 184 +++++++++++++----- .../codex/codex-rs/core/src/codex_thread.rs | 108 ++++++++++ .../codex/codex-rs/protocol/src/protocol.rs | 19 ++ 34 files changed, 1029 insertions(+), 93 deletions(-) create mode 100644 vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyJobBackendKind.ts diff --git a/README.md b/README.md index e8d3a326..dec87deb 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ The current spine is real, not aspirational: - read-only map/churn proposal through `thread/epiphany/propose` - verifier-backed promotion through `thread/epiphany/promote` - successful-write notifications through `thread/epiphany/stateUpdated` +- durable `jobBindings` as a thin Epiphany-owned launcher seam over runtime job backends - live bound-job progress notifications through `thread/epiphany/jobsUpdated` - read-only reflection surfaces through `thread/epiphany/scene`, `jobs`, `freshness`, `context`, and `pressure` - durable investigation checkpointing for compaction-safe planning diff --git a/notes/epiphany-core-harness-surfaces.md b/notes/epiphany-core-harness-surfaces.md index 9dc7cc21..7cc86e14 100644 --- a/notes/epiphany-core-harness-surfaces.md +++ b/notes/epiphany-core-harness-surfaces.md @@ -46,9 +46,9 @@ The rule is: | `thread/epiphany/propose` | read-only proposal | landed | Drafts graph/frontier/churn candidates from verified evidence-backed observations. | | `thread/epiphany/promote` | verifier gate | landed | Rejects or applies candidates through the durable update path. | | `thread/epiphany/stateUpdated` | notification | landed | Emits updated projected state, source, revision, and changed fields after successful update/promote writes. | -| `thread/epiphany/jobsUpdated` | notification | landed | Emits changed bound-job snapshots for real runtime progress events when the mapped job payload actually changes. | +| `thread/epiphany/jobsUpdated` | notification | landed | Emits changed launcher-bound job snapshots for real runtime progress events when the mapped payload actually changes. | | `thread/epiphany/scene` | read-only reflection | landed, live-smoked | Compact client scene derived from authoritative Epiphany state, including checkpoint summary reflection. | -| `thread/epiphany/jobs` | read-only reflection | landed, live-smoked | Derived indexing, remap, verification, and specialist-progress slots from typed state and retrieval summaries, with durable `jobBindings` plus live runtime `agent_jobs` overlay when a real owner exists. | +| `thread/epiphany/jobs` | read-only reflection | landed, live-smoked | Derived indexing, remap, verification, and specialist-progress slots from typed state and retrieval summaries, with durable launcher metadata plus live backend overlay when a real owner exists. | | `thread/epiphany/freshness` | read-only reflection | landed, live-smoked | Retrieval and graph freshness lens derived from retrieval summaries plus graph frontier/churn state, with watcher-backed invalidation inputs for loaded threads. | | `thread/epiphany/context` | read-only reflection | landed, live-smoked | Targeted state shard for graph nodes/edges, active frontier, graph checkpoint, investigation checkpoint, observations, and evidence. | | `thread/epiphany/pressure` | read-only reflection | landed, live-smoked | Context-pressure gauge derived from token telemetry and recorded auto-compact/context limits. | @@ -131,7 +131,7 @@ Metaphor is compression after source context. It is not decoration for guesses. These are not landed yet: -- an Epiphany-owned long-running job launcher beyond binding to existing runtime `agent_jobs` +- an explicit launch/interrupt surface over the landed thin launcher seam - richer evidence-range and graph-shard inspection beyond the landed context shard - automatic watcher-driven graph/retrieval/invariant invalidation policy on top of the landed freshness reflection - automatic tool-output observation promotion @@ -147,17 +147,19 @@ and a verification story. The first read-only job/progress reflection is landed as `thread/epiphany/jobs`. It reports derived slots for retrieval indexing, graph remap, invariant -verification, and specialist work, and can overlay durable `jobBindings` onto -live runtime `agent_jobs` snapshots. It does not start, schedule, create, or -notify jobs. +verification, and specialist work. Durable `jobBindings` now act as a thin +Epiphany-owned launcher seam: they can carry launcher identity, authority +scope, backend kind, and backend job id, and the current adapter can overlay +that launcher metadata onto live runtime `agent_jobs` snapshots. The surface +does not start, schedule, create, or notify jobs. The first live bound-runtime progress notification is also landed as `thread/epiphany/jobsUpdated`. It rides existing `agent_job_progress:{json}` -background events from the runtime job runner, resolves matching durable -bindings against live `agent_jobs` snapshots, and only emits when the mapped -bound-job payload actually changes. It does not poll state runtime in a loop, -start work, schedule follow-up work, or turn the jobs read surface into a -writer. +background events from the runtime job runner, resolves matching launcher +bindings against live `agent_jobs` snapshots through the current backend +adapter, and only emits when the mapped bound-job payload actually changes. It +does not poll state runtime in a loop, start work, schedule follow-up work, or +turn the jobs read surface into a writer. Future live job state should describe work like: @@ -173,6 +175,10 @@ Minimum useful fields: - `kind` - `scope` - `ownerRole` +- `launcherJobId` +- `authorityScope` +- `backendKind` +- `backendJobId` - `status` - `runtimeAgentJobId` - `itemsProcessed` @@ -267,9 +273,9 @@ invalidation telemetry now exists inside that freshness surface for loaded threads, durable investigation packets now exist in typed state plus prompt/scene/context reflection, and the first bounded policy verdict now exists as `thread/epiphany/reorient`. What does not exist yet is the runtime -coordinator that acts on that verdict. Automatic CRRC still needs job owners, -interruption-safe ownership, and explicit runtime policy instead of vibes with a -clipboard. +coordinator that acts on that verdict. Automatic CRRC still needs launch and +interrupt authority over the thin job seam, job owners that can be stopped +cleanly, and explicit runtime policy instead of vibes with a clipboard. Compaction should squeeze scratch, not the map. diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index e6e4a68d..87326d4f 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -23,8 +23,8 @@ The spine exists in seventeen 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, 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), 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: app-server declares experimental read-only `thread/epiphany/scene`, 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 in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:340), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:3924), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4115), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:10757). -- job/progress reflection: app-server declares experimental read-only `thread/epiphany/jobs`, reads the same thread view as scene, optionally fills retrieval state for loaded threads with no Epiphany state, and derives four non-authoritative progress slots for retrieval indexing, graph remap, invariant verification, and specialist work. Durable `job_bindings` can now overlay those slots onto live runtime `agent_jobs` snapshots so the surface can show real owner/progress/thread information without scheduling, notifying, mutating, or persisting runtime jobs in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:347), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4142), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4176), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:11998). -- bound-job progress notifications: app-server now declares experimental `thread/epiphany/jobsUpdated`, listens for `agent_job_progress:{json}` background events from the runtime job runner, resolves matching durable `job_bindings` against live `agent_jobs` snapshots, and emits only the changed bound-job payloads when the mapped job state actually differs from the last notification for that thread. It does not poll in a loop, mutate Epiphany state, schedule work, or make `thread/epiphany/jobs` a writer. +- job/progress reflection: app-server declares experimental read-only `thread/epiphany/jobs`, reads the same thread view as scene, optionally fills retrieval state for loaded threads with no Epiphany state, and derives four non-authoritative progress slots for retrieval indexing, graph remap, invariant verification, and specialist work. Durable `job_bindings` now act as a thin Epiphany-owned launcher seam with launcher id, authority scope, backend kind, and backend job id; the current adapter can overlay those launcher bindings onto live runtime `agent_jobs` snapshots so the surface can show real owner/progress/thread information without scheduling, notifying, mutating, or persisting runtime jobs in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:347), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4142), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4176), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:11998). +- bound-job progress notifications: app-server now declares experimental `thread/epiphany/jobsUpdated`, listens for `agent_job_progress:{json}` background events from the runtime job runner, resolves matching launcher bindings against live `agent_jobs` snapshots through the current backend adapter, and emits only the changed bound-job payloads when the mapped job state actually differs from the last notification for that thread. It does not poll in a loop, mutate Epiphany state, schedule work, or make `thread/epiphany/jobs` a writer. - freshness reflection: app-server declares experimental read-only `thread/epiphany/freshness`, reads the same live/stored thread view used by scene/jobs/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). - targeted context reflection: app-server declares experimental read-only `thread/epiphany/context`, reads the same live/stored Epiphany state view used by scene/jobs, and derives a bounded state shard containing selected graph nodes/edges, links, active frontier, checkpoint, the full durable investigation-checkpoint packet, observations, direct evidence, linked evidence, and missing requested ids without retrieval, proposal, promotion, notification, mutation, or persistence in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:355), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4253), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4261), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:11152). - context-pressure reflection: core token telemetry carries `model_auto_compact_token_limit` beside total/last usage and `model_context_window`; app-server declares experimental read-only `thread/epiphany/pressure`, reads live token usage or the latest stored rollout `TokenCount`, and derives `unknown`/`low`/`elevated`/`high`/`critical` pressure plus a non-acting compaction-prep recommendation without mutating Epiphany state or scheduling compaction in [protocol.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/protocol/src/protocol.rs:2237), [turn_context.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/session/turn_context.rs:103), [session/mod.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/session/mod.rs:2716), [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:360), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4361), [token_usage_replay.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor/token_usage_replay.rs:75), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4306), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:11028). @@ -1006,7 +1006,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 can then attach owner/scope/linkage metadata and, when they point at a real runtime `agent_jobs` record, overlay live status, progress counts, runtime job id, and active worker thread ids. If the runtime seam is missing or the referenced job is gone, 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 a thin launcher seam: they can attach launcher id, authority scope, backend kind/job id, plus owner/scope/linkage metadata and, when the current backend adapter can resolve a real runtime `agent_jobs` record, overlay live status, progress counts, runtime job id, and active worker thread ids. If the runtime seam is missing or the referenced job is gone, the slot blocks honestly instead of improvising a secret scheduler. Protocol shape: @@ -1020,10 +1020,14 @@ Response shape: - `jobs` - `id` - `kind` - - `scope` - - `ownerRole` - - `status` - - optional `itemsProcessed` +- `scope` +- `ownerRole` +- optional `launcherJobId` +- optional `authorityScope` +- optional `backendKind` +- optional `backendJobId` +- `status` +- optional `itemsProcessed` - optional `itemsTotal` - optional `progressNote` - optional `lastCheckpointAtUnixSeconds` @@ -1056,13 +1060,13 @@ The app-server handler: 1. returns base `retrieval-index`, `graph-remap`, `verification`, and `specialist-work` slots from retrieval state, frontier/churn state, invariant counts, and the no-scheduler boundary. 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. -4. when a binding carries `runtime_agent_job_id` and the state runtime can resolve it, overlays live runtime `agent_jobs` status, progress counts, progress note, runtime job id, and active worker thread ids onto the slot. -5. when the state runtime is unavailable or the referenced runtime job is missing, blocks the bound slot with an explicit reason instead of pretending the work is running. +3. if authoritative typed state carries `jobBindings`, matches those bindings onto the base slots by id/kind and reflects launcher identity, authority scope, backend kind, and backend job id. +4. when a binding targets the current `agent_jobs` backend and the state runtime can resolve it, overlays live runtime `agent_jobs` status, progress counts, progress note, runtime job id, and active worker thread ids onto the slot. +5. when the state runtime is unavailable or the referenced backend job is missing, blocks the bound slot with an explicit reason instead of pretending the work is running. ### Output -The response is a typed progress board derived from the current Epiphany machine. The Phase 6 jobs smoke proved that missing-state jobs can still reflect retrieval while graph/remap and verification stay blocked, ready-state jobs expose revision identity and needed remap/verification pressure, a bound specialist runtime job surfaces `running` plus its runtime job id and active worker thread id, no `thread/epiphany/stateUpdated` or `thread/epiphany/jobsUpdated` notification is emitted by the read, and final thread state revision does not change. +The response is a typed progress board derived from the current Epiphany machine. The Phase 6 jobs smoke proved that missing-state jobs can still reflect retrieval while graph/remap and verification stay blocked, ready-state jobs expose revision identity and launcher metadata, a bound specialist runtime job surfaces `running` plus launcher id, authority scope, backend kind/job id, runtime job id, and active worker thread id, no `thread/epiphany/stateUpdated` or `thread/epiphany/jobsUpdated` notification is emitted by the read, and final thread state revision does not change. ### Invariant @@ -1304,7 +1308,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 context-pressure gauge, not the first durable investigation checkpoint packet, and no longer the first bounded reorientation verdict. 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 scene, jobs, freshness, context, pressure, and reorient surfaces give clients compact or bounded read-only views without making the GUI/client authoritative, scene/context surface the checkpoint packet back out without becoming writers, freshness surfaces watcher telemetry without becoming a hidden worker, and reorient now turns those signals into an explicit wakeup verdict. The remaining missing organs are a stricter launcher seam if runtime `agent_jobs` stops being enough, a runtime consumer that can act on the reorientation verdict without becoming a hidden tyrant, and eventually role-scoped specialist ownership without silently auto-promoting anything. +The current remaining missing organ is not the red pen, not the first chewing motion, 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 context-pressure gauge, not the first durable investigation checkpoint packet, not the first bounded reorientation verdict, and no longer the first thin launcher seam. 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, and the bound jobs now reflect launcher id, authority scope, and backend kind/job id instead of treating raw runtime pointers as the architecture. The scene, jobs, freshness, context, pressure, and reorient surfaces give clients compact or bounded read-only views without making the GUI/client authoritative, scene/context surface the checkpoint packet back out without becoming writers, freshness surfaces watcher telemetry without becoming a hidden worker, and reorient now turns those signals into an explicit wakeup verdict. The remaining missing organs are an explicit launch/interrupt authority surface over the landed seam, a second backend if `agent_jobs` stops being enough, a runtime consumer that can act on the reorientation verdict without becoming a hidden tyrant, and eventually role-scoped specialist ownership without silently auto-promoting anything. ```text model/tool observations @@ -1318,7 +1322,7 @@ model/tool observations The typed write path exists, the first deterministic observation/evidence distillation path exists, source-output-aware distillation now summarizes noisy tool/model output into typed evidence with final result/error/finished lines ahead of generic warnings, the first deterministic map/churn proposal path exists, proposal-quality hardening now auto-selects bounded observation clusters when ids are omitted, requires accepting recent evidence, reuses existing graph nodes by observed code refs, prioritizes stronger selected observations, rescues unanchored graph nodes by strict semantic overlap, focuses linked frontier context, reports match-kind-aware map-delta pressure, and the first verifier-backed promotion gate exists. The first map/churn safety layer also exists: promotion can reject state replacement patches that are not tied to explicit observations/evidence, that contain structurally broken subgoal, invariant, graph, frontier, checkpoint, investigation-checkpoint, or churn fields, that try to promote risky churn without a warning and stronger verifier evidence, that claim a graph expansion is low-pressure to dodge the warning gate, or that rely on substring verifier-kind accidents. The first live state notification layer also exists: accepted writes publish updated typed state plus event-level revision and typed changed fields; rejected promotions stay quiet. -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, 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, 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, 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` seam, or coordinate 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 pressure gauge exists; the first ember packet exists; the first verdict slip now exists too; the next slices are about safe waking and real ownership, not jawbones. +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, 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, 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, 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 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 pressure gauge exists; the first ember packet exists; the first verdict slip now exists too; the next slices are about safe waking and real ownership, not jawbones. ## Verification Hooks diff --git a/notes/epiphany-fork-implementation-plan.md b/notes/epiphany-fork-implementation-plan.md index 86438d99..04905595 100644 --- a/notes/epiphany-fork-implementation-plan.md +++ b/notes/epiphany-fork-implementation-plan.md @@ -51,6 +51,7 @@ The landed machine now has: - read-only map/churn proposal through `thread/epiphany/propose` - verifier-backed promotion through `thread/epiphany/promote` - successful-write notification through `thread/epiphany/stateUpdated` +- thin Epiphany-owned launcher metadata in durable `jobBindings`, with launcher id, authority scope, and backend kind/job id - live bound-runtime progress notification through `thread/epiphany/jobsUpdated` - response-level and notification-level revision and changed-field metadata - direct-update validation for malformed appended records and structural replacements @@ -83,8 +84,8 @@ These boundaries are more important than the individual method names: - Durable typed state writes go through `thread/epiphany/update` or accepted `thread/epiphany/promote`. - `thread/epiphany/index` may update the semantic retrieval catalog, but it is not a hidden Epiphany-state writer. - `thread/epiphany/scene` is a client reflection, not a second source of truth. -- `thread/epiphany/jobs` is a derived reflection over retrieval summaries, typed `jobBindings`, and optional runtime `agent_jobs` snapshots, not a scheduler or durable runtime job store. -- `thread/epiphany/jobsUpdated` is a live notification derived from runtime progress events and bound-job snapshots, not a scheduler, polling daemon, or durable runtime job store. +- `thread/epiphany/jobs` is a derived reflection over retrieval summaries plus typed launcher bindings and optional backend snapshots, not a scheduler or durable runtime job store. +- `thread/epiphany/jobsUpdated` is a live notification derived from runtime progress events and launcher-bound job snapshots, not a scheduler, polling daemon, or durable runtime job store. - `thread/epiphany/freshness` is a derived reflection, not automatic watcher-driven invalidation, a mutation gate, or a hidden refresh scheduler. - `thread/epiphany/context` is a targeted reflection, not a state writer or hidden proposal engine. - `thread/epiphany/pressure` is a context-pressure reflection, not an automatic compactor, scheduler, or CRRC coordinator. @@ -125,7 +126,7 @@ and notify typed state. It can. The next unknowns are: -- whether future Epiphany-owned long-running work should keep parasitizing runtime `agent_jobs` now that `thread/epiphany/jobsUpdated` exists, or whether the fork needs a stricter launcher seam +- how the landed thin launcher seam should expose explicit launch and interrupt authority without becoming a secret scheduler - how the landed watcher-backed invalidation telemetry should be consumed without turning freshness into a secret worker - how the landed reorientation verdict should be consumed by future automatic CRRC without becoming ceremony machinery - how much automatic CRRC coordination belongs in runtime once pressure, freshness, watcher, checkpoint, and reorientation signals all exist @@ -137,7 +138,7 @@ Phase 6 should grow observable harness state outward from the typed spine. Useful candidates: -1. Decide whether future Epiphany-owned long-running work should keep parasitizing runtime `agent_jobs` or needs a stricter fork-owned launcher seam. +1. Add an explicit launch/interrupt authority surface over the landed thin launcher seam while keeping `agent_jobs` as the first backend adapter. 2. Decide how the landed reorientation verdict should be consumed by future automatic CRRC without becoming ceremony machinery. 3. Add targeted scene/jobs/context/pressure/reorient fields only when a client or smoke exposes a real gap. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index ba7a4848..c751765b 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -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/freshness`, `thread/epiphany/context`, `thread/epiphany/pressure`, and `thread/epiphany/reorient`; jobs can now overlay durable `jobBindings` onto live runtime `agent_jobs` progress for loaded threads, and `thread/epiphany/jobsUpdated` now translates live `agent_job_progress:{json}` background events into changed bound-job notifications without polling or scheduling. Freshness carries watcher-backed invalidation inputs, and reorient turns checkpoint plus freshness/pressure/watcher signals into a read-only resume-versus-regather verdict. +- Phase 6 has read-only `thread/epiphany/scene`, `thread/epiphany/jobs`, `thread/epiphany/freshness`, `thread/epiphany/context`, `thread/epiphany/pressure`, and `thread/epiphany/reorient`; durable `jobBindings` now act as a thin Epiphany-owned launcher seam with launcher id, authority scope, and backend kind/job id, jobs can overlay that seam 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, and reorient turns checkpoint plus freshness/pressure/watcher signals into a read-only resume-versus-regather verdict. - Durable in-flight investigation checkpointing is now landed in authoritative typed state, writable through `thread/epiphany/update` or accepted `thread/epiphany/promote`, rendered into the prompt, and reflected through scene/context. - The repo is an Epiphany fork of Codex, not a Codex preset. - `vendor/codex` is tracked directly, not a submodule. @@ -62,9 +62,10 @@ The current spine: - read-only map/churn proposal through `thread/epiphany/propose` - verifier-backed promotion through `thread/epiphany/promote` - successful-write notification through `thread/epiphany/stateUpdated` +- thin launcher metadata in durable `jobBindings` - live bound-job progress notification through `thread/epiphany/jobsUpdated` - read-only compact reflection through `thread/epiphany/scene` -- read-only job/progress reflection through `thread/epiphany/jobs`, with durable `jobBindings` plus live runtime `agent_jobs` overlay +- read-only job/progress reflection through `thread/epiphany/jobs`, with durable launcher metadata plus live runtime `agent_jobs` overlay - read-only retrieval/graph freshness reflection plus watcher-backed invalidation inputs through `thread/epiphany/freshness` - read-only targeted state-shard reflection through `thread/epiphany/context` - read-only context-pressure reflection through `thread/epiphany/pressure` @@ -211,12 +212,11 @@ still deserves `resume` or has to admit `regather`. Also keep the guardrail in mind: a read-only reorientation verdict is still not automatic CRRC. Runtime coordination and next-action execution are still future work even though read-only job ownership/progress reflection now has a real -runtime seam. +runtime seam and a thin launcher boundary. -When the user asks to continue, the next likely organ is deciding whether -future Epiphany-owned long-running work should keep parasitizing runtime -`agent_jobs` now that `thread/epiphany/jobsUpdated` exists, or whether the -fork needs a stricter launcher seam before specialist ownership grows teeth. +When the user asks to continue, the next likely organ is an explicit +launch/interrupt authority surface over the landed thin launcher seam, still +backed by runtime `agent_jobs` until a second backend deserves to exist. Live `thread/epiphany/scene`, `thread/epiphany/jobs`, `thread/epiphany/freshness`, `thread/epiphany/context`, @@ -230,6 +230,7 @@ guardrails, not the next organs. - specialist-agent scheduling - GUI-as-source-of-truth - automatic runtime CRRC coordinator acting on the landed reorientation verdict +- explicit launch/interrupt authority surface over the landed thin launcher seam - Epiphany-owned long-running job execution beyond the current runtime `agent_jobs` seam - broad event stream beyond the landed state update notification diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 6989a101..eb0a5385 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -44,3 +44,5 @@ {"ts": "2026-04-26T10:45:36+00:00", "type": "verification", "status": "ok", "note": "Phase 6 bounded CRRC reorientation policy landed as read-only thread/epiphany/reorient. The surface consumes checkpoint, freshness, watcher, and pressure signals to return resume-versus-regather with explicit checkpoint-path/frontier reasons, without mutation, compaction, scheduling, notification, or silent continuation. Focused protocol/schema checks, app-server mapper tests/build, and tools/epiphany_phase6_reorient_smoke.py plus tools/epiphany_phase6_scene_smoke.py passed."} {"ts": "2026-04-26T11:30:59+00:00", "type": "verification", "status": "ok", "note": "Phase 6 jobs reflection now carries durable jobBindings in EpiphanyThreadState and overlays real runtime agent_jobs progress in read-only thread/epiphany/jobs, including runtime job ids, worker thread ids, and progress counts. The live seam required direct state-runtime lookup rather than rollout get_state_db backfill. Focused protocol/core/app-server tests, schema fixture checks, app-server build, and tools/epiphany_phase6_jobs_smoke.py passed."} {"ts": "2026-04-26T14:01:57+00:00", "type": "verification", "status": "ok", "note": "Phase 6 live bound-job progress notification landed as experimental thread/epiphany/jobsUpdated. App-server now translates runtime agent_job_progress:{json} background events into changed bound-job payloads by resolving durable jobBindings against live agent_jobs snapshots, suppressing duplicate unchanged payloads without polling, state mutation, or scheduling. Focused app-server notification coverage, schema fixture checks, and tools/epiphany_phase6_jobs_smoke.py passed."} +{"ts": "2026-04-26T14:57:54+00:00", "type": "design", "status": "accepted", "note": "Durable jobBindings now define a thin Epiphany-owned launcher seam: launcher identity, authority scope, backend kind, and backend job id belong to Epiphany even while the first backend adapter still targets runtime agent_jobs. This keeps job ownership and authority explicit without prematurely building a second scheduler or runtime."} +{"ts": "2026-04-26T14:57:54+00:00", "type": "verification", "status": "ok", "note": "Phase 6 thin launcher seam landed in durable jobBindings and thread/epiphany/jobs reflection. Jobs and jobsUpdated now surface launcherJobId, authorityScope, backendKind, and backendJobId while the current adapter still resolves runtime agent_jobs progress. Focused codex-core epiphany_state_update tests, app-server-protocol thread_epiphany and schema fixture tests, app-server mapper plus jobsUpdated notification tests, cargo build -p codex-app-server, and tools/epiphany_phase6_jobs_smoke.py passed."} diff --git a/state/map.yaml b/state/map.yaml index d4f75b7a..bafb0096 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -73,15 +73,16 @@ accepted_design: - Context pressure must become an explicit runtime signal for automatic CRRC; inference from transcript vibes, user warnings, or shrinking safe scope is useful only as a temporary human/agent heuristic. - The harness now has an in-flight investigation checkpoint packet in durable typed state; automatic CRRC still needs runtime logic that reads the packet and decides whether to resume or force reorientation and re-gathering after compaction. - GUI/client work must reflect or steer typed state rather than manufacture a second source of truth. - - `thread/epiphany/jobs` is a read-only job/progress reflection: it derives indexing, remap, verification, and specialist slots from authoritative state and retrieval summaries, and can overlay durable `job_bindings` onto live runtime `agent_jobs` snapshots when a real owner exists; it is not a scheduler, notification stream, or durable runtime job table. - - `thread/epiphany/jobsUpdated` is the first live bound-job progress notification: it translates runtime `agent_job_progress:{json}` background events into changed bound-job payloads by resolving durable `job_bindings` against live `agent_jobs` snapshots, without polling in a loop, mutating state, or scheduling work. + - Durable `job_bindings` now form a thin Epiphany-owned launcher seam: bindings can carry launcher identity, authority scope, backend kind, and backend job id while still supporting the older runtime-agent-job pointer as a compatibility alias. + - `thread/epiphany/jobs` is a read-only job/progress reflection: it derives indexing, remap, verification, and specialist slots from authoritative state and retrieval summaries, and can overlay durable launcher bindings onto live runtime `agent_jobs` snapshots through the current backend adapter when a real owner exists; it is not a scheduler, notification stream, or durable runtime job table. + - `thread/epiphany/jobsUpdated` is the first live bound-job progress notification: it translates runtime `agent_job_progress:{json}` background events into changed launcher-bound payloads by resolving durable `job_bindings` against live `agent_jobs` snapshots through the current backend adapter, without polling in a loop, mutating state, or scheduling work. - `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. - `thread/epiphany/context` is the first targeted read-only state-shard surface: it selects graph nodes/edges, active frontier, checkpoint, observations, and evidence from authoritative typed state without mutating or notifying. - `thread/epiphany/pressure` is the first read-only context-pressure surface: it derives pressure from token telemetry and auto-compact/context limits without compacting, scheduling, mutating, or notifying. - `thread/epiphany/reorient` is the first bounded CRRC policy surface: it derives a read-only `resume` versus `regather` verdict from checkpoint, freshness, watcher, and pressure signals without mutating state, compacting, scheduling, or silently continuing work. - 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. - 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. - - Epiphany-owned long-running job execution beyond the current runtime `agent_jobs` seam and specialist scheduling are still future work. + - Explicit launch/interrupt authority over the thin job seam, Epiphany-owned long-running job execution beyond the current runtime `agent_jobs` backend, and specialist scheduling are still future work. - 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. @@ -96,7 +97,7 @@ landed_baseline: - Phase 3: typed client read surface through `Thread.epiphanyState`. - Phase 4: hybrid retrieval plus explicit Qdrant indexing with BM25 fallback. - Phase 5: typed update/distill/propose/promote/read/notification control plane. - - Phase 6: read-only scene, job/progress, freshness with watcher-backed invalidation inputs, targeted context, context-pressure, and reorientation policy surfaces, plus durable investigation checkpointing for compaction-safe planning and live bound-job progress notifications. + - Phase 6: read-only scene, job/progress, freshness with watcher-backed invalidation inputs, targeted context, context-pressure, and reorientation policy surfaces, plus durable investigation checkpointing for compaction-safe planning, live bound-job progress notifications, and a thin launcher seam in durable job bindings. guardrails: - Use `tools/epiphany_phase5_smoke.py` before modifying update, distill, propose, promote, read-projection, or notification behavior. - Use `tools/epiphany_phase6_scene_smoke.py` before modifying scene projection behavior. @@ -124,5 +125,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, freshness, targeted context, context-pressure reflection, watcher-backed invalidation inputs, durable investigation checkpointing, bounded CRRC reorientation policy, and live bound-job progress notifications are landed. `thread/epiphany/jobs` now carries durable `job_bindings` in authoritative typed state and overlays real runtime `agent_jobs` progress for bound work, including runtime job id, worker thread ids, and progress counts, without becoming a scheduler. `thread/epiphany/jobsUpdated` now translates runtime `agent_job_progress:{json}` background events into changed bound-job payloads only when the mapped job state actually changes, so clients can watch real owners move without polling the jobs read surface. `thread/epiphany/reorient` still consumes checkpoint, freshness, watcher, and pressure signals to return a read-only `resume` versus `regather` verdict with explicit checkpoint-path/frontier reasons, but it does not mutate state, compact, schedule, notify, or silently continue work. Focused protocol/app-server tests, schema fixture regeneration/checks, app-server build, and the live jobs smoke cover the seam. Investigation checkpoints still live in authoritative typed state, flow through the prompt, and reflect through scene/context without adding a second writer or fake scheduler. Persistent state was cut down so map, handoff, plan, harness surfaces, scratch, and evidence each carry one job instead of becoming a Jenga tower; evidence is now a distilled ledger rather than an activity feed. The global AGENTS Epiphany core command says persistent state is the agent's mind and explicitly permits the agent to ask for self-modification when memory or workflow makes it worse. The continuity goal is to bank the fire before the dark so compaction becomes less like death and more like sleep. - next_action: After compaction, rehydrate and reorient. If the user asks to continue, the next likely Phase 6 organ is deciding whether future Epiphany-owned long-running work should keep parasitizing runtime `agent_jobs` now that `thread/epiphany/jobsUpdated` exists, or whether the fork needs a stricter launcher seam before specialist ownership grows teeth. Automatic runtime CRRC remains future work that may eventually consume the landed read-only reorientation verdict. Do not restart the completed pressure, freshness, watcher-invalidation, investigation-checkpoint, reorientation, jobs-binding, or jobsUpdated slice unless a concrete regression appears. + 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, freshness, targeted context, context-pressure reflection, watcher-backed invalidation inputs, durable investigation checkpointing, bounded CRRC reorientation policy, live bound-job progress notifications, and a thin launcher seam in durable `job_bindings` are landed. `job_bindings` now carry Epiphany-owned launcher metadata such as launcher id, authority scope, and backend kind/job id, while still tolerating the older runtime-agent-job pointer as a compatibility alias. `thread/epiphany/jobs` overlays that launcher seam onto real runtime `agent_jobs` progress for bound work, including runtime/backend job id, worker thread ids, and progress counts, without becoming a scheduler. `thread/epiphany/jobsUpdated` now translates runtime `agent_job_progress:{json}` background events into changed launcher-bound payloads only when the mapped job state actually changes, so clients can watch real owners move without polling the jobs read surface. `thread/epiphany/reorient` still consumes checkpoint, freshness, watcher, and pressure signals to return a read-only `resume` versus `regather` verdict with explicit checkpoint-path/frontier reasons, but it does not mutate state, compact, schedule, notify, or silently continue work. Focused core/protocol/app-server tests, schema fixture regeneration/checks, app-server build, and the live jobs smoke cover the seam. Investigation checkpoints still live in authoritative typed state, flow through the prompt, and reflect through scene/context without adding a second writer or fake scheduler. Persistent state was cut down so map, handoff, plan, harness surfaces, scratch, and evidence each carry one job instead of becoming a Jenga tower; evidence is now a distilled ledger rather than an activity feed. The global AGENTS Epiphany core command says persistent state is the agent's mind and explicitly permits the agent to ask for self-modification when memory or workflow makes it worse. The continuity goal is to bank the fire before the dark so compaction becomes less like death and more like sleep. + next_action: After compaction, rehydrate and reorient. If the user asks to continue, the next likely Phase 6 organ is an explicit launch/interrupt authority surface over the landed thin launcher seam, still backed by runtime `agent_jobs` until a second backend deserves to exist. Automatic runtime CRRC remains future work that may eventually consume the landed read-only reorientation verdict. Do not restart the completed pressure, freshness, watcher-invalidation, investigation-checkpoint, reorientation, jobs-binding, jobsUpdated, or thin-launcher-seam slice unless a concrete regression appears. diff --git a/tools/epiphany_phase6_jobs_smoke.py b/tools/epiphany_phase6_jobs_smoke.py index 0da1cee1..bc21e61d 100644 --- a/tools/epiphany_phase6_jobs_smoke.py +++ b/tools/epiphany_phase6_jobs_smoke.py @@ -184,6 +184,10 @@ def job_surface_patch(runtime_agent_job_id: str) -> dict[str, Any]: "kind": "specialist", "scope": "role-scoped specialist work", "owner_role": "epiphany-harness", + "launcher_job_id": "launcher-specialist-smoke", + "authority_scope": "epiphany.specialist", + "backend_kind": "agent_jobs", + "backend_job_id": runtime_agent_job_id, "runtime_agent_job_id": runtime_agent_job_id, "linked_subgoal_ids": ["phase6-jobs-smoke"], "linked_graph_node_ids": ["job-surface"], @@ -249,6 +253,22 @@ def assert_ready_jobs(response: dict[str, Any]) -> None: specialist = job_by_id(response["jobs"], "specialist-work") require(specialist["status"] == "running", "bound specialist job should report real runtime progress") + require( + specialist["launcherJobId"] == "launcher-specialist-smoke", + "specialist launcher job id should surface through jobs reflection", + ) + require( + specialist["authorityScope"] == "epiphany.specialist", + "specialist authority scope should surface through jobs reflection", + ) + require( + specialist["backendKind"] == "agentJobs", + "specialist backend kind should surface through jobs reflection", + ) + require( + specialist["backendJobId"] == "job-specialist-smoke", + "specialist backend job id should surface through jobs reflection", + ) require( specialist["runtimeAgentJobId"] == "job-specialist-smoke", "specialist runtime job id should surface through jobs reflection", @@ -358,6 +378,18 @@ def run_smoke(args: argparse.Namespace) -> dict[str, Any]: ready_response["jobs"], "verification" )["itemsTotal"], "specialistStatus": job_by_id(ready_response["jobs"], "specialist-work")["status"], + "specialistLauncherJobId": job_by_id( + ready_response["jobs"], "specialist-work" + )["launcherJobId"], + "specialistAuthorityScope": job_by_id( + ready_response["jobs"], "specialist-work" + )["authorityScope"], + "specialistBackendKind": job_by_id( + ready_response["jobs"], "specialist-work" + )["backendKind"], + "specialistBackendJobId": job_by_id( + ready_response["jobs"], "specialist-work" + )["backendJobId"], "specialistRuntimeAgentJobId": job_by_id( ready_response["jobs"], "specialist-work" )["runtimeAgentJobId"], diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/ClientRequest.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/ClientRequest.json index a78eca8a..69892409 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/ClientRequest.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/ClientRequest.json @@ -1159,8 +1159,36 @@ ], "type": "string" }, + "EpiphanyJobBackendKind": { + "enum": [ + "agent_jobs" + ], + "type": "string" + }, "EpiphanyJobBinding": { "properties": { + "authority_scope": { + "type": [ + "string", + "null" + ] + }, + "backend_job_id": { + "type": [ + "string", + "null" + ] + }, + "backend_kind": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blocking_reason": { "type": [ "string", @@ -1173,6 +1201,12 @@ "kind": { "$ref": "#/definitions/EpiphanyJobKind" }, + "launcher_job_id": { + "type": [ + "string", + "null" + ] + }, "linked_graph_node_ids": { "items": { "type": "string" diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/ServerNotification.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/ServerNotification.json index f76df74e..ab2315d5 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/ServerNotification.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/ServerNotification.json @@ -1419,8 +1419,36 @@ ], "type": "string" }, + "EpiphanyJobBackendKind": { + "enum": [ + "agent_jobs" + ], + "type": "string" + }, "EpiphanyJobBinding": { "properties": { + "authority_scope": { + "type": [ + "string", + "null" + ] + }, + "backend_job_id": { + "type": [ + "string", + "null" + ] + }, + "backend_kind": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blocking_reason": { "type": [ "string", @@ -1433,6 +1461,12 @@ "kind": { "$ref": "#/definitions/EpiphanyJobKind" }, + "launcher_job_id": { + "type": [ + "string", + "null" + ] + }, "linked_graph_node_ids": { "items": { "type": "string" @@ -3864,6 +3898,28 @@ }, "type": "array" }, + "authorityScope": { + "type": [ + "string", + "null" + ] + }, + "backendJobId": { + "type": [ + "string", + "null" + ] + }, + "backendKind": { + "anyOf": [ + { + "$ref": "#/definitions/ThreadEpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blockingReason": { "type": [ "string", @@ -3899,6 +3955,12 @@ "null" ] }, + "launcherJobId": { + "type": [ + "string", + "null" + ] + }, "linkedGraphNodeIds": { "items": { "type": "string" @@ -3942,6 +4004,12 @@ ], "type": "object" }, + "ThreadEpiphanyJobBackendKind": { + "enum": [ + "agentJobs" + ], + "type": "string" + }, "ThreadEpiphanyJobKind": { "enum": [ "indexing", diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json index 5a38a131..5ffe61bf 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json @@ -8288,8 +8288,36 @@ ], "type": "string" }, + "EpiphanyJobBackendKind": { + "enum": [ + "agent_jobs" + ], + "type": "string" + }, "EpiphanyJobBinding": { "properties": { + "authority_scope": { + "type": [ + "string", + "null" + ] + }, + "backend_job_id": { + "type": [ + "string", + "null" + ] + }, + "backend_kind": { + "anyOf": [ + { + "$ref": "#/definitions/v2/EpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blocking_reason": { "type": [ "string", @@ -8302,6 +8330,12 @@ "kind": { "$ref": "#/definitions/v2/EpiphanyJobKind" }, + "launcher_job_id": { + "type": [ + "string", + "null" + ] + }, "linked_graph_node_ids": { "items": { "type": "string" @@ -15240,6 +15274,28 @@ }, "type": "array" }, + "authorityScope": { + "type": [ + "string", + "null" + ] + }, + "backendJobId": { + "type": [ + "string", + "null" + ] + }, + "backendKind": { + "anyOf": [ + { + "$ref": "#/definitions/v2/ThreadEpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blockingReason": { "type": [ "string", @@ -15275,6 +15331,12 @@ "null" ] }, + "launcherJobId": { + "type": [ + "string", + "null" + ] + }, "linkedGraphNodeIds": { "items": { "type": "string" @@ -15318,6 +15380,12 @@ ], "type": "object" }, + "ThreadEpiphanyJobBackendKind": { + "enum": [ + "agentJobs" + ], + "type": "string" + }, "ThreadEpiphanyJobKind": { "enum": [ "indexing", diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json index 96f03553..f1833095 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json @@ -4828,8 +4828,36 @@ ], "type": "string" }, + "EpiphanyJobBackendKind": { + "enum": [ + "agent_jobs" + ], + "type": "string" + }, "EpiphanyJobBinding": { "properties": { + "authority_scope": { + "type": [ + "string", + "null" + ] + }, + "backend_job_id": { + "type": [ + "string", + "null" + ] + }, + "backend_kind": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blocking_reason": { "type": [ "string", @@ -4842,6 +4870,12 @@ "kind": { "$ref": "#/definitions/EpiphanyJobKind" }, + "launcher_job_id": { + "type": [ + "string", + "null" + ] + }, "linked_graph_node_ids": { "items": { "type": "string" @@ -13127,6 +13161,28 @@ }, "type": "array" }, + "authorityScope": { + "type": [ + "string", + "null" + ] + }, + "backendJobId": { + "type": [ + "string", + "null" + ] + }, + "backendKind": { + "anyOf": [ + { + "$ref": "#/definitions/ThreadEpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blockingReason": { "type": [ "string", @@ -13162,6 +13218,12 @@ "null" ] }, + "launcherJobId": { + "type": [ + "string", + "null" + ] + }, "linkedGraphNodeIds": { "items": { "type": "string" @@ -13205,6 +13267,12 @@ ], "type": "object" }, + "ThreadEpiphanyJobBackendKind": { + "enum": [ + "agentJobs" + ], + "type": "string" + }, "ThreadEpiphanyJobKind": { "enum": [ "indexing", diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadEpiphanyJobsUpdatedNotification.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadEpiphanyJobsUpdatedNotification.json index 243344bc..36055864 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadEpiphanyJobsUpdatedNotification.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadEpiphanyJobsUpdatedNotification.json @@ -9,6 +9,28 @@ }, "type": "array" }, + "authorityScope": { + "type": [ + "string", + "null" + ] + }, + "backendJobId": { + "type": [ + "string", + "null" + ] + }, + "backendKind": { + "anyOf": [ + { + "$ref": "#/definitions/ThreadEpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blockingReason": { "type": [ "string", @@ -44,6 +66,12 @@ "null" ] }, + "launcherJobId": { + "type": [ + "string", + "null" + ] + }, "linkedGraphNodeIds": { "items": { "type": "string" @@ -87,6 +115,12 @@ ], "type": "object" }, + "ThreadEpiphanyJobBackendKind": { + "enum": [ + "agentJobs" + ], + "type": "string" + }, "ThreadEpiphanyJobKind": { "enum": [ "indexing", diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadEpiphanyStateUpdatedNotification.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadEpiphanyStateUpdatedNotification.json index 8dc7a0e5..680ee138 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadEpiphanyStateUpdatedNotification.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadEpiphanyStateUpdatedNotification.json @@ -418,8 +418,36 @@ ], "type": "string" }, + "EpiphanyJobBackendKind": { + "enum": [ + "agent_jobs" + ], + "type": "string" + }, "EpiphanyJobBinding": { "properties": { + "authority_scope": { + "type": [ + "string", + "null" + ] + }, + "backend_job_id": { + "type": [ + "string", + "null" + ] + }, + "backend_kind": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blocking_reason": { "type": [ "string", @@ -432,6 +460,12 @@ "kind": { "$ref": "#/definitions/EpiphanyJobKind" }, + "launcher_job_id": { + "type": [ + "string", + "null" + ] + }, "linked_graph_node_ids": { "items": { "type": "string" diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json index 93f162ee..362ac639 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json @@ -866,8 +866,36 @@ ], "type": "string" }, + "EpiphanyJobBackendKind": { + "enum": [ + "agent_jobs" + ], + "type": "string" + }, "EpiphanyJobBinding": { "properties": { + "authority_scope": { + "type": [ + "string", + "null" + ] + }, + "backend_job_id": { + "type": [ + "string", + "null" + ] + }, + "backend_kind": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blocking_reason": { "type": [ "string", @@ -880,6 +908,12 @@ "kind": { "$ref": "#/definitions/EpiphanyJobKind" }, + "launcher_job_id": { + "type": [ + "string", + "null" + ] + }, "linked_graph_node_ids": { "items": { "type": "string" diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json index 7ff05008..2b3e452e 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json @@ -807,8 +807,36 @@ ], "type": "string" }, + "EpiphanyJobBackendKind": { + "enum": [ + "agent_jobs" + ], + "type": "string" + }, "EpiphanyJobBinding": { "properties": { + "authority_scope": { + "type": [ + "string", + "null" + ] + }, + "backend_job_id": { + "type": [ + "string", + "null" + ] + }, + "backend_kind": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blocking_reason": { "type": [ "string", @@ -821,6 +849,12 @@ "kind": { "$ref": "#/definitions/EpiphanyJobKind" }, + "launcher_job_id": { + "type": [ + "string", + "null" + ] + }, "linked_graph_node_ids": { "items": { "type": "string" diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json index 70fef008..492a7662 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json @@ -807,8 +807,36 @@ ], "type": "string" }, + "EpiphanyJobBackendKind": { + "enum": [ + "agent_jobs" + ], + "type": "string" + }, "EpiphanyJobBinding": { "properties": { + "authority_scope": { + "type": [ + "string", + "null" + ] + }, + "backend_job_id": { + "type": [ + "string", + "null" + ] + }, + "backend_kind": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blocking_reason": { "type": [ "string", @@ -821,6 +849,12 @@ "kind": { "$ref": "#/definitions/EpiphanyJobKind" }, + "launcher_job_id": { + "type": [ + "string", + "null" + ] + }, "linked_graph_node_ids": { "items": { "type": "string" diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json index c331ef96..2a5a1367 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json @@ -807,8 +807,36 @@ ], "type": "string" }, + "EpiphanyJobBackendKind": { + "enum": [ + "agent_jobs" + ], + "type": "string" + }, "EpiphanyJobBinding": { "properties": { + "authority_scope": { + "type": [ + "string", + "null" + ] + }, + "backend_job_id": { + "type": [ + "string", + "null" + ] + }, + "backend_kind": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blocking_reason": { "type": [ "string", @@ -821,6 +849,12 @@ "kind": { "$ref": "#/definitions/EpiphanyJobKind" }, + "launcher_job_id": { + "type": [ + "string", + "null" + ] + }, "linked_graph_node_ids": { "items": { "type": "string" diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json index 0bbf9db2..165a2219 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json @@ -866,8 +866,36 @@ ], "type": "string" }, + "EpiphanyJobBackendKind": { + "enum": [ + "agent_jobs" + ], + "type": "string" + }, "EpiphanyJobBinding": { "properties": { + "authority_scope": { + "type": [ + "string", + "null" + ] + }, + "backend_job_id": { + "type": [ + "string", + "null" + ] + }, + "backend_kind": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blocking_reason": { "type": [ "string", @@ -880,6 +908,12 @@ "kind": { "$ref": "#/definitions/EpiphanyJobKind" }, + "launcher_job_id": { + "type": [ + "string", + "null" + ] + }, "linked_graph_node_ids": { "items": { "type": "string" diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json index 30667de3..589ac405 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json @@ -807,8 +807,36 @@ ], "type": "string" }, + "EpiphanyJobBackendKind": { + "enum": [ + "agent_jobs" + ], + "type": "string" + }, "EpiphanyJobBinding": { "properties": { + "authority_scope": { + "type": [ + "string", + "null" + ] + }, + "backend_job_id": { + "type": [ + "string", + "null" + ] + }, + "backend_kind": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blocking_reason": { "type": [ "string", @@ -821,6 +849,12 @@ "kind": { "$ref": "#/definitions/EpiphanyJobKind" }, + "launcher_job_id": { + "type": [ + "string", + "null" + ] + }, "linked_graph_node_ids": { "items": { "type": "string" diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json index 7b6dc19a..d0a9fdc2 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json @@ -866,8 +866,36 @@ ], "type": "string" }, + "EpiphanyJobBackendKind": { + "enum": [ + "agent_jobs" + ], + "type": "string" + }, "EpiphanyJobBinding": { "properties": { + "authority_scope": { + "type": [ + "string", + "null" + ] + }, + "backend_job_id": { + "type": [ + "string", + "null" + ] + }, + "backend_kind": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blocking_reason": { "type": [ "string", @@ -880,6 +908,12 @@ "kind": { "$ref": "#/definitions/EpiphanyJobKind" }, + "launcher_job_id": { + "type": [ + "string", + "null" + ] + }, "linked_graph_node_ids": { "items": { "type": "string" diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json index a707bcdc..ab3e3eae 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json @@ -807,8 +807,36 @@ ], "type": "string" }, + "EpiphanyJobBackendKind": { + "enum": [ + "agent_jobs" + ], + "type": "string" + }, "EpiphanyJobBinding": { "properties": { + "authority_scope": { + "type": [ + "string", + "null" + ] + }, + "backend_job_id": { + "type": [ + "string", + "null" + ] + }, + "backend_kind": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blocking_reason": { "type": [ "string", @@ -821,6 +849,12 @@ "kind": { "$ref": "#/definitions/EpiphanyJobKind" }, + "launcher_job_id": { + "type": [ + "string", + "null" + ] + }, "linked_graph_node_ids": { "items": { "type": "string" diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json index 3d140d30..16b10a5b 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json +++ b/vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json @@ -807,8 +807,36 @@ ], "type": "string" }, + "EpiphanyJobBackendKind": { + "enum": [ + "agent_jobs" + ], + "type": "string" + }, "EpiphanyJobBinding": { "properties": { + "authority_scope": { + "type": [ + "string", + "null" + ] + }, + "backend_job_id": { + "type": [ + "string", + "null" + ] + }, + "backend_kind": { + "anyOf": [ + { + "$ref": "#/definitions/EpiphanyJobBackendKind" + }, + { + "type": "null" + } + ] + }, "blocking_reason": { "type": [ "string", @@ -821,6 +849,12 @@ "kind": { "$ref": "#/definitions/EpiphanyJobKind" }, + "launcher_job_id": { + "type": [ + "string", + "null" + ] + }, "linked_graph_node_ids": { "items": { "type": "string" diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/typescript/EpiphanyJobBinding.ts b/vendor/codex/codex-rs/app-server-protocol/schema/typescript/EpiphanyJobBinding.ts index c0a6dbbf..4986678c 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/typescript/EpiphanyJobBinding.ts +++ b/vendor/codex/codex-rs/app-server-protocol/schema/typescript/EpiphanyJobBinding.ts @@ -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, runtime_agent_job_id?: string | null, linked_subgoal_ids?: Array, linked_graph_node_ids?: Array, progress_note?: string | null, blocking_reason?: string | null, }; +export type EpiphanyJobBinding = { id: string, kind: EpiphanyJobKind, scope: string, owner_role: string, launcher_job_id?: string | null, authority_scope?: string | null, backend_kind?: EpiphanyJobBackendKind | null, backend_job_id?: string | null, runtime_agent_job_id?: string | null, linked_subgoal_ids?: Array, linked_graph_node_ids?: Array, progress_note?: string | null, blocking_reason?: string | null, }; diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyJob.ts b/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyJob.ts index c5212e83..9ecf4a6f 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyJob.ts +++ b/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyJob.ts @@ -1,7 +1,8 @@ // GENERATED CODE! DO NOT MODIFY BY HAND! // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ThreadEpiphanyJobBackendKind } from "./ThreadEpiphanyJobBackendKind"; import type { ThreadEpiphanyJobKind } from "./ThreadEpiphanyJobKind"; import type { ThreadEpiphanyJobStatus } from "./ThreadEpiphanyJobStatus"; -export type ThreadEpiphanyJob = { id: string, kind: ThreadEpiphanyJobKind, scope: string, ownerRole: string, status: ThreadEpiphanyJobStatus, runtimeAgentJobId?: string | null, itemsProcessed?: number | null, itemsTotal?: number | null, progressNote?: string | null, lastCheckpointAtUnixSeconds?: bigint | null, blockingReason?: string | null, activeThreadIds?: Array, linkedSubgoalIds?: Array, linkedGraphNodeIds?: Array, }; +export type ThreadEpiphanyJob = { id: string, kind: ThreadEpiphanyJobKind, scope: string, ownerRole: string, launcherJobId?: string | null, authorityScope?: string | null, backendKind?: ThreadEpiphanyJobBackendKind | null, backendJobId?: string | null, status: ThreadEpiphanyJobStatus, runtimeAgentJobId?: string | null, itemsProcessed?: number | null, itemsTotal?: number | null, progressNote?: string | null, lastCheckpointAtUnixSeconds?: bigint | null, blockingReason?: string | null, activeThreadIds?: Array, linkedSubgoalIds?: Array, linkedGraphNodeIds?: Array, }; diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyJobBackendKind.ts b/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyJobBackendKind.ts new file mode 100644 index 00000000..b570e7f7 --- /dev/null +++ b/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyJobBackendKind.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ThreadEpiphanyJobBackendKind = "agentJobs"; diff --git a/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/index.ts b/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/index.ts index 01bb8d16..1da98b05 100644 --- a/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/index.ts +++ b/vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/index.ts @@ -328,6 +328,7 @@ export type { ThreadEpiphanyGraphFreshnessStatus } from "./ThreadEpiphanyGraphFr export type { ThreadEpiphanyInvalidationInput } from "./ThreadEpiphanyInvalidationInput"; export type { ThreadEpiphanyInvalidationStatus } from "./ThreadEpiphanyInvalidationStatus"; export type { ThreadEpiphanyJob } from "./ThreadEpiphanyJob"; +export type { ThreadEpiphanyJobBackendKind } from "./ThreadEpiphanyJobBackendKind"; export type { ThreadEpiphanyJobKind } from "./ThreadEpiphanyJobKind"; export type { ThreadEpiphanyJobStatus } from "./ThreadEpiphanyJobStatus"; export type { ThreadEpiphanyJobsSource } from "./ThreadEpiphanyJobsSource"; diff --git a/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs b/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs index 321179d8..702248aa 100644 --- a/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs +++ b/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs @@ -1821,6 +1821,10 @@ mod tests { kind: v2::ThreadEpiphanyJobKind::Indexing, scope: "/workspace".to_string(), owner_role: "epiphany-core".to_string(), + launcher_job_id: None, + authority_scope: None, + backend_kind: None, + backend_job_id: None, status: v2::ThreadEpiphanyJobStatus::Needed, runtime_agent_job_id: None, items_processed: Some(12), @@ -2566,6 +2570,10 @@ mod tests { kind: v2::ThreadEpiphanyJobKind::Specialist, scope: "runtime-bound specialist work".to_string(), owner_role: "epiphany-harness".to_string(), + launcher_job_id: Some("launcher-specialist".to_string()), + authority_scope: Some("epiphany.specialist".to_string()), + backend_kind: Some(v2::ThreadEpiphanyJobBackendKind::AgentJobs), + backend_job_id: Some("job-123".to_string()), status: v2::ThreadEpiphanyJobStatus::Running, runtime_agent_job_id: Some("job-123".to_string()), items_processed: Some(1), @@ -2591,6 +2599,10 @@ mod tests { "kind": "specialist", "scope": "runtime-bound specialist work", "ownerRole": "epiphany-harness", + "launcherJobId": "launcher-specialist", + "authorityScope": "epiphany.specialist", + "backendKind": "agentJobs", + "backendJobId": "job-123", "status": "running", "runtimeAgentJobId": "job-123", "itemsProcessed": 1, @@ -3309,6 +3321,10 @@ mod tests { kind: v2::ThreadEpiphanyJobKind::Specialist, scope: "runtime-bound specialist work".to_string(), owner_role: "epiphany-harness".to_string(), + launcher_job_id: Some("launcher-specialist".to_string()), + authority_scope: Some("epiphany.specialist".to_string()), + backend_kind: Some(v2::ThreadEpiphanyJobBackendKind::AgentJobs), + backend_job_id: Some("job-123".to_string()), status: v2::ThreadEpiphanyJobStatus::Running, runtime_agent_job_id: Some("job-123".to_string()), items_processed: Some(1), diff --git a/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs b/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs index 148b5643..8e3fae15 100644 --- a/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs +++ b/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs @@ -4286,6 +4286,13 @@ pub enum ThreadEpiphanyJobKind { Specialist, } +#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub enum ThreadEpiphanyJobBackendKind { + AgentJobs, +} + #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)] #[serde(rename_all = "camelCase")] #[ts(export_to = "v2/")] @@ -4309,6 +4316,18 @@ pub struct ThreadEpiphanyJob { pub kind: ThreadEpiphanyJobKind, pub scope: String, pub owner_role: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional = nullable)] + pub launcher_job_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional = nullable)] + pub authority_scope: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional = nullable)] + pub backend_kind: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional = nullable)] + pub backend_job_id: Option, pub status: ThreadEpiphanyJobStatus, #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional = nullable)] diff --git a/vendor/codex/codex-rs/app-server/README.md b/vendor/codex/codex-rs/app-server/README.md index a3bbb1f3..65b72a5d 100644 --- a/vendor/codex/codex-rs/app-server/README.md +++ b/vendor/codex/codex-rs/app-server/README.md @@ -146,7 +146,7 @@ Experimental Epiphany retrieval: - `thread/epiphany/promote` is an explicit loaded-thread-only promotion gate. It evaluates a patch plus verifier evidence, rejects with reasons without mutating state when policy fails, and applies the patch through the durable update path when accepted. Accepted responses include the landed `revision` and `changedFields`. - `thread/epiphany/update` is the explicit loaded-thread-only control-plane write path for Epiphany state. It can append observations/evidence and replace bounded typed state fields such as objective, subgoals, graph frontier/checkpoint, scratch, churn, and mode; it bumps the Epiphany revision, returns `revision` plus `changedFields`, and persists a rollout snapshot immediately. - `thread/epiphany/stateUpdated` is an experimental server notification emitted after successful `thread/epiphany/update` and accepted `thread/epiphany/promote`. It carries the updated typed `epiphanyState`, a `source` of `update` or `promote`, event-level `revision`, and typed `changedFields`; rejected promotions do not emit it. -- `thread/epiphany/jobsUpdated` is an experimental server notification emitted from live `agent_job_progress:{json}` background events when a runtime `agent_jobs` owner is bound through durable `jobBindings` and the mapped bound-job payload actually changes. It carries the current `stateRevision` plus the changed bound job snapshots; it does not turn `thread/epiphany/jobs` into a writer or scheduler. +- `thread/epiphany/jobsUpdated` is an experimental server notification emitted from live `agent_job_progress:{json}` background events when a launcher-bound `agent_jobs` backend owner advances and the mapped job payload actually changes. It carries the current `stateRevision` plus the changed job snapshots, including launcher metadata such as `launcherJobId`, `authorityScope`, `backendKind`, and `backendJobId`; it does not turn `thread/epiphany/jobs` into a writer or scheduler. - `thread/epiphany/freshness` is a read-only reflection surface for retrieval and graph staleness. It reports revision/source identity, retrieval freshness, graph freshness, and exact dirty-path pressure, and for loaded threads now also reports watcher-backed invalidation inputs with watched root, changed paths, mapped graph-node hits, and active-frontier hits. It still does not mutate state, schedule refresh work, or perform automatic watcher-driven semantic invalidation. - `thread/epiphany/reorient` is a read-only CRRC policy surface. It consumes the durable investigation checkpoint plus freshness, watcher, and pressure signals to return a bounded `resume` versus `regather` verdict with explicit checkpoint-path/frontier reasons. It does not mutate state, compact, notify, schedule, or silently continue work on the caller's behalf. The request envelope is camelCase, but nested reused Epiphany core DTOs currently keep their core snake_case fields, such as `source_kind`, `understanding_status`, and `diff_pressure`. diff --git a/vendor/codex/codex-rs/app-server/src/bespoke_event_handling.rs b/vendor/codex/codex-rs/app-server/src/bespoke_event_handling.rs index e8048b08..eea391b8 100644 --- a/vendor/codex/codex-rs/app-server/src/bespoke_event_handling.rs +++ b/vendor/codex/codex-rs/app-server/src/bespoke_event_handling.rs @@ -2,7 +2,7 @@ use crate::codex_message_processor::ApiVersion; use crate::codex_message_processor::read_rollout_items_from_rollout; use crate::codex_message_processor::read_summary_from_rollout; use crate::codex_message_processor::summary_to_thread; -use crate::codex_message_processor::thread_epiphany_jobs_updated_notification_for_runtime_job; +use crate::codex_message_processor::thread_epiphany_jobs_updated_notification_for_agent_job_progress; use crate::error_code::INTERNAL_ERROR_CODE; use crate::error_code::INVALID_REQUEST_ERROR_CODE; use crate::outgoing_message::ClientRequestResult; @@ -2028,7 +2028,7 @@ async fn maybe_emit_thread_epiphany_jobs_updated( } }; - let Some(notification) = thread_epiphany_jobs_updated_notification_for_runtime_job( + let Some(notification) = thread_epiphany_jobs_updated_notification_for_agent_job_progress( conversation_id, conversation.as_ref(), progress.job_id.as_str(), @@ -4656,6 +4656,10 @@ mod tests { kind: codex_protocol::protocol::EpiphanyJobKind::Specialist, scope: "runtime-bound specialist work".to_string(), owner_role: "epiphany-harness".to_string(), + launcher_job_id: Some("launcher-specialist".to_string()), + authority_scope: Some("epiphany.specialist".to_string()), + backend_kind: Some(codex_protocol::protocol::EpiphanyJobBackendKind::AgentJobs), + backend_job_id: Some("job-specialist".to_string()), runtime_agent_job_id: Some("job-specialist".to_string()), linked_subgoal_ids: vec!["phase6-jobs".to_string()], linked_graph_node_ids: vec!["job-surface".to_string()], @@ -4726,6 +4730,13 @@ mod tests { job.status, codex_app_server_protocol::ThreadEpiphanyJobStatus::Running ); + assert_eq!(job.launcher_job_id.as_deref(), Some("launcher-specialist")); + assert_eq!(job.authority_scope.as_deref(), Some("epiphany.specialist")); + assert_eq!( + job.backend_kind, + Some(codex_app_server_protocol::ThreadEpiphanyJobBackendKind::AgentJobs) + ); + assert_eq!(job.backend_job_id.as_deref(), Some("job-specialist")); assert_eq!(job.runtime_agent_job_id.as_deref(), Some("job-specialist")); assert_eq!(job.items_processed, Some(1)); assert_eq!(job.items_total, Some(3)); diff --git a/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs b/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs index a1d75bb8..2d0dc4df 100644 --- a/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs +++ b/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs @@ -167,6 +167,7 @@ use codex_app_server_protocol::ThreadEpiphanyIndexResponse; use codex_app_server_protocol::ThreadEpiphanyInvalidationInput; use codex_app_server_protocol::ThreadEpiphanyInvalidationStatus; use codex_app_server_protocol::ThreadEpiphanyJob; +use codex_app_server_protocol::ThreadEpiphanyJobBackendKind; use codex_app_server_protocol::ThreadEpiphanyJobKind; use codex_app_server_protocol::ThreadEpiphanyJobStatus; use codex_app_server_protocol::ThreadEpiphanyJobsParams; @@ -404,6 +405,7 @@ use codex_protocol::protocol::ConversationStartParams; use codex_protocol::protocol::ConversationStartTransport; use codex_protocol::protocol::ConversationTextParams; use codex_protocol::protocol::EpiphanyInvestigationDisposition; +use codex_protocol::protocol::EpiphanyJobBackendKind as CoreEpiphanyJobBackendKind; use codex_protocol::protocol::EpiphanyJobBinding; use codex_protocol::protocol::EpiphanyJobKind as CoreEpiphanyJobKind; use codex_protocol::protocol::EpiphanyRetrievalState; @@ -4223,7 +4225,7 @@ impl CodexMessageProcessor { if state_db_ctx.is_none() { state_db_ctx = open_state_db_for_direct_thread_lookup(&self.config).await; } - let job_resolution = load_epiphany_agent_job_snapshots( + let job_resolution = load_epiphany_job_launcher_snapshots( state_db_ctx.as_ref(), thread.epiphany_state.as_ref(), ) @@ -11922,13 +11924,13 @@ fn extend_unique_strings(target: &mut Vec, values: impl IntoIterator, +struct EpiphanyJobLauncherResolution { + agent_jobs_available: bool, + snapshots_by_binding_id: HashMap, } #[derive(Debug, Clone)] -struct EpiphanyAgentJobSnapshot { +struct EpiphanyJobBackendSnapshot { status: AgentJobStatus, progress: AgentJobProgress, updated_at_unix_seconds: i64, @@ -11936,16 +11938,44 @@ struct EpiphanyAgentJobSnapshot { active_thread_ids: Vec, } -pub(crate) async fn thread_epiphany_jobs_updated_notification_for_runtime_job( +fn binding_launcher_job_id(binding: &EpiphanyJobBinding) -> Option<&str> { + binding.launcher_job_id.as_deref() +} + +fn binding_backend_kind(binding: &EpiphanyJobBinding) -> Option { + binding.backend_kind.or_else(|| { + if binding.runtime_agent_job_id.is_some() { + Some(CoreEpiphanyJobBackendKind::AgentJobs) + } else { + None + } + }) +} + +fn binding_backend_job_id(binding: &EpiphanyJobBinding) -> Option<&str> { + binding + .backend_job_id + .as_deref() + .or(binding.runtime_agent_job_id.as_deref()) +} + +fn binding_agent_jobs_job_id(binding: &EpiphanyJobBinding) -> Option<&str> { + match binding_backend_kind(binding) { + Some(CoreEpiphanyJobBackendKind::AgentJobs) => binding_backend_job_id(binding), + None => None, + } +} + +pub(crate) async fn thread_epiphany_jobs_updated_notification_for_agent_job_progress( thread_id: ThreadId, thread: &CodexThread, - runtime_agent_job_id: &str, + agent_job_id: &str, ) -> Option { let state = thread.epiphany_state().await?; let binding_ids = state .job_bindings .iter() - .filter(|binding| binding.runtime_agent_job_id.as_deref() == Some(runtime_agent_job_id)) + .filter(|binding| binding_agent_jobs_job_id(binding) == Some(agent_job_id)) .map(|binding| binding.id.clone()) .collect::>(); if binding_ids.is_empty() { @@ -11959,7 +11989,8 @@ pub(crate) async fn thread_epiphany_jobs_updated_notification_for_runtime_job( } else { None }; - let job_resolution = load_epiphany_agent_job_snapshots(Some(&state_db_ctx), Some(&state)).await; + let job_resolution = + load_epiphany_job_launcher_snapshots(Some(&state_db_ctx), Some(&state)).await; let jobs = map_epiphany_jobs(Some(&state), retrieval_override.as_ref(), &job_resolution) .into_iter() .filter(|job| binding_ids.contains(job.id.as_str())) @@ -11976,43 +12007,40 @@ pub(crate) async fn thread_epiphany_jobs_updated_notification_for_runtime_job( }) } -async fn load_epiphany_agent_job_snapshots( +async fn load_epiphany_job_launcher_snapshots( state_db_ctx: Option<&StateDbHandle>, state: Option<&EpiphanyThreadState>, -) -> EpiphanyAgentJobResolution { +) -> EpiphanyJobLauncherResolution { let Some(state) = state else { - return EpiphanyAgentJobResolution::default(); + return EpiphanyJobLauncherResolution::default(); }; let Some(state_db_ctx) = state_db_ctx else { - return EpiphanyAgentJobResolution { - available: false, + return EpiphanyJobLauncherResolution { + agent_jobs_available: false, snapshots_by_binding_id: HashMap::new(), }; }; - let mut resolution = EpiphanyAgentJobResolution { - available: true, + let mut resolution = EpiphanyJobLauncherResolution { + agent_jobs_available: true, snapshots_by_binding_id: HashMap::new(), }; for binding in &state.job_bindings { - let Some(runtime_agent_job_id) = binding.runtime_agent_job_id.as_deref() else { + let Some(agent_job_id) = binding_agent_jobs_job_id(binding) else { continue; }; - let Ok(Some(job)) = state_db_ctx.get_agent_job(runtime_agent_job_id).await else { + let Ok(Some(job)) = state_db_ctx.get_agent_job(agent_job_id).await else { continue; }; - let Ok(progress) = state_db_ctx - .get_agent_job_progress(runtime_agent_job_id) - .await - else { + let Ok(progress) = state_db_ctx.get_agent_job_progress(agent_job_id).await else { continue; }; let active_thread_ids = state_db_ctx .list_agent_job_items( - runtime_agent_job_id, + agent_job_id, Some(AgentJobItemStatus::Running), /*limit*/ Some(64), ) @@ -12024,7 +12052,7 @@ async fn load_epiphany_agent_job_snapshots( resolution.snapshots_by_binding_id.insert( binding.id.clone(), - EpiphanyAgentJobSnapshot { + EpiphanyJobBackendSnapshot { status: job.status, progress, updated_at_unix_seconds: job.updated_at.timestamp(), @@ -12040,7 +12068,7 @@ async fn load_epiphany_agent_job_snapshots( fn map_epiphany_jobs( state: Option<&EpiphanyThreadState>, retrieval_override: Option<&EpiphanyRetrievalState>, - job_resolution: &EpiphanyAgentJobResolution, + job_resolution: &EpiphanyJobLauncherResolution, ) -> Vec { let mut jobs = vec![ map_epiphany_index_job(state, retrieval_override), @@ -12075,8 +12103,8 @@ fn map_epiphany_jobs( fn map_epiphany_bound_job( binding: &EpiphanyJobBinding, - snapshot: Option<&EpiphanyAgentJobSnapshot>, - job_resolution: &EpiphanyAgentJobResolution, + snapshot: Option<&EpiphanyJobBackendSnapshot>, + job_resolution: &EpiphanyJobLauncherResolution, ) -> ThreadEpiphanyJob { overlay_epiphany_job_binding( ThreadEpiphanyJob { @@ -12084,12 +12112,16 @@ 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), + authority_scope: binding.authority_scope.clone(), + backend_kind: binding_backend_kind(binding).map(map_core_epiphany_job_backend_kind), + backend_job_id: binding_backend_job_id(binding).map(str::to_string), status: if binding.blocking_reason.is_some() { ThreadEpiphanyJobStatus::Blocked } else { ThreadEpiphanyJobStatus::Idle }, - runtime_agent_job_id: binding.runtime_agent_job_id.clone(), + runtime_agent_job_id: binding_agent_jobs_job_id(binding).map(str::to_string), items_processed: None, items_total: None, progress_note: None, @@ -12108,13 +12140,17 @@ fn map_epiphany_bound_job( fn overlay_epiphany_job_binding( mut job: ThreadEpiphanyJob, binding: &EpiphanyJobBinding, - snapshot: Option<&EpiphanyAgentJobSnapshot>, - job_resolution: &EpiphanyAgentJobResolution, + snapshot: Option<&EpiphanyJobBackendSnapshot>, + job_resolution: &EpiphanyJobLauncherResolution, ) -> ThreadEpiphanyJob { job.kind = map_core_epiphany_job_kind(binding.kind); job.scope = binding.scope.clone(); job.owner_role = binding.owner_role.clone(); - job.runtime_agent_job_id = binding.runtime_agent_job_id.clone(); + job.launcher_job_id = binding_launcher_job_id(binding).map(str::to_string); + job.authority_scope = binding.authority_scope.clone(); + job.backend_kind = binding_backend_kind(binding).map(map_core_epiphany_job_backend_kind); + job.backend_job_id = binding_backend_job_id(binding).map(str::to_string); + job.runtime_agent_job_id = binding_agent_jobs_job_id(binding).map(str::to_string); if !binding.linked_subgoal_ids.is_empty() { job.linked_subgoal_ids = binding.linked_subgoal_ids.clone(); } @@ -12148,15 +12184,15 @@ fn overlay_epiphany_job_binding( return job; } - if let Some(runtime_agent_job_id) = binding.runtime_agent_job_id.as_deref() { + if let Some(agent_job_id) = binding_agent_jobs_job_id(binding) { job.status = ThreadEpiphanyJobStatus::Blocked; - job.blocking_reason = Some(if job_resolution.available { + job.blocking_reason = Some(if job_resolution.agent_jobs_available { format!( - "Bound runtime agent job {:?} was not found in state runtime.", - runtime_agent_job_id + "Bound agent_jobs backend job {:?} was not found in state runtime.", + agent_job_id ) } else { - "State runtime is unavailable, so bound runtime agent jobs cannot be resolved." + "State runtime is unavailable, so agent_jobs backend bindings cannot be resolved." .to_string() }); } @@ -12164,6 +12200,14 @@ fn overlay_epiphany_job_binding( job } +fn map_core_epiphany_job_backend_kind( + kind: CoreEpiphanyJobBackendKind, +) -> ThreadEpiphanyJobBackendKind { + match kind { + CoreEpiphanyJobBackendKind::AgentJobs => ThreadEpiphanyJobBackendKind::AgentJobs, + } +} + fn map_core_epiphany_job_kind(kind: CoreEpiphanyJobKind) -> ThreadEpiphanyJobKind { match kind { CoreEpiphanyJobKind::Indexing => ThreadEpiphanyJobKind::Indexing, @@ -12196,7 +12240,7 @@ fn progress_processed_items(progress: &AgentJobProgress) -> u32 { .unwrap_or(u32::MAX) } -fn render_agent_job_progress_note(snapshot: &EpiphanyAgentJobSnapshot) -> String { +fn render_agent_job_progress_note(snapshot: &EpiphanyJobBackendSnapshot) -> String { let progress = &snapshot.progress; match snapshot.status { AgentJobStatus::Pending => format!( @@ -12244,6 +12288,10 @@ fn map_epiphany_index_job( kind: ThreadEpiphanyJobKind::Indexing, scope: "workspace".to_string(), owner_role: "epiphany-core".to_string(), + launcher_job_id: None, + authority_scope: None, + backend_kind: None, + backend_job_id: None, status: ThreadEpiphanyJobStatus::Unavailable, runtime_agent_job_id: None, items_processed: None, @@ -12277,6 +12325,10 @@ fn map_epiphany_index_job( kind: ThreadEpiphanyJobKind::Indexing, scope: retrieval.workspace_root.display().to_string(), owner_role: "epiphany-core".to_string(), + launcher_job_id: None, + authority_scope: None, + backend_kind: None, + backend_job_id: None, status: epiphany_job_status_from_retrieval_status(retrieval.status), runtime_agent_job_id: None, items_processed: retrieval.indexed_file_count, @@ -12340,6 +12392,10 @@ fn map_epiphany_remap_job(state: Option<&EpiphanyThreadState>) -> ThreadEpiphany kind: ThreadEpiphanyJobKind::Remap, scope: "architecture/dataflow graphs".to_string(), owner_role: "epiphany-core".to_string(), + launcher_job_id: None, + authority_scope: None, + backend_kind: None, + backend_job_id: None, status: if needs_work { ThreadEpiphanyJobStatus::Needed } else { @@ -12391,6 +12447,10 @@ fn map_epiphany_verification_job(state: Option<&EpiphanyThreadState>) -> ThreadE kind: ThreadEpiphanyJobKind::Verification, scope: "invariants/evidence".to_string(), owner_role: "epiphany-harness".to_string(), + launcher_job_id: None, + authority_scope: None, + backend_kind: None, + backend_job_id: None, status, runtime_agent_job_id: None, items_processed: Some(verified), @@ -12410,6 +12470,10 @@ fn map_epiphany_specialist_job() -> ThreadEpiphanyJob { kind: ThreadEpiphanyJobKind::Specialist, scope: "role-scoped specialist work".to_string(), owner_role: "epiphany-harness".to_string(), + launcher_job_id: None, + authority_scope: None, + backend_kind: None, + backend_job_id: None, status: ThreadEpiphanyJobStatus::Unavailable, runtime_agent_job_id: None, items_processed: None, @@ -12437,6 +12501,10 @@ fn epiphany_blocked_state_job( kind, scope: scope.to_string(), owner_role: "epiphany-harness".to_string(), + launcher_job_id: None, + authority_scope: None, + backend_kind: None, + backend_job_id: None, status: ThreadEpiphanyJobStatus::Blocked, runtime_agent_job_id: None, items_processed: None, @@ -14823,7 +14891,11 @@ mod tests { ..Default::default() }; - let jobs = map_epiphany_jobs(Some(&state), None, &EpiphanyAgentJobResolution::default()); + let jobs = map_epiphany_jobs( + Some(&state), + None, + &EpiphanyJobLauncherResolution::default(), + ); assert_eq!(jobs.len(), 4); assert_eq!(jobs[0].id, "retrieval-index"); @@ -14863,7 +14935,7 @@ mod tests { let jobs = map_epiphany_jobs( None, Some(&retrieval), - &EpiphanyAgentJobResolution::default(), + &EpiphanyJobLauncherResolution::default(), ); assert_eq!(jobs[0].status, ThreadEpiphanyJobStatus::Idle); @@ -14880,6 +14952,10 @@ mod tests { kind: codex_protocol::protocol::EpiphanyJobKind::Specialist, scope: "role-scoped specialist work".to_string(), owner_role: "epiphany-harness".to_string(), + launcher_job_id: Some("launcher-specialist-1".to_string()), + authority_scope: Some("epiphany.specialist".to_string()), + backend_kind: Some(codex_protocol::protocol::EpiphanyJobBackendKind::AgentJobs), + backend_job_id: Some("job-specialist-1".to_string()), runtime_agent_job_id: Some("job-specialist-1".to_string()), linked_subgoal_ids: vec!["phase-6".to_string()], linked_graph_node_ids: vec!["job-surface".to_string()], @@ -14888,11 +14964,11 @@ mod tests { }], ..Default::default() }; - let resolution = EpiphanyAgentJobResolution { - available: true, + let resolution = EpiphanyJobLauncherResolution { + agent_jobs_available: true, snapshots_by_binding_id: HashMap::from([( "specialist-work".to_string(), - EpiphanyAgentJobSnapshot { + EpiphanyJobBackendSnapshot { status: AgentJobStatus::Running, progress: AgentJobProgress { total_items: 3, @@ -14915,6 +14991,22 @@ mod tests { .expect("specialist slot should exist"); assert_eq!(specialist.status, ThreadEpiphanyJobStatus::Running); + assert_eq!( + specialist.launcher_job_id.as_deref(), + Some("launcher-specialist-1") + ); + assert_eq!( + specialist.authority_scope.as_deref(), + Some("epiphany.specialist") + ); + assert_eq!( + specialist.backend_kind, + Some(ThreadEpiphanyJobBackendKind::AgentJobs) + ); + assert_eq!( + specialist.backend_job_id.as_deref(), + Some("job-specialist-1") + ); assert_eq!( specialist.runtime_agent_job_id.as_deref(), Some("job-specialist-1") @@ -14940,6 +15032,10 @@ mod tests { kind: codex_protocol::protocol::EpiphanyJobKind::Specialist, scope: "role-scoped specialist work".to_string(), owner_role: "epiphany-harness".to_string(), + launcher_job_id: Some("launcher-specialist-missing".to_string()), + authority_scope: Some("epiphany.specialist".to_string()), + backend_kind: Some(codex_protocol::protocol::EpiphanyJobBackendKind::AgentJobs), + backend_job_id: Some("job-missing".to_string()), runtime_agent_job_id: Some("job-missing".to_string()), linked_subgoal_ids: Vec::new(), linked_graph_node_ids: Vec::new(), @@ -14948,8 +15044,8 @@ mod tests { }], ..Default::default() }; - let resolution = EpiphanyAgentJobResolution { - available: true, + let resolution = EpiphanyJobLauncherResolution { + agent_jobs_available: true, snapshots_by_binding_id: HashMap::new(), }; diff --git a/vendor/codex/codex-rs/core/src/codex_thread.rs b/vendor/codex/codex-rs/core/src/codex_thread.rs index 0a94b4ff..c7417071 100644 --- a/vendor/codex/codex-rs/core/src/codex_thread.rs +++ b/vendor/codex/codex-rs/core/src/codex_thread.rs @@ -32,6 +32,7 @@ use codex_protocol::protocol::EpiphanyGraphFrontier; use codex_protocol::protocol::EpiphanyGraphs; use codex_protocol::protocol::EpiphanyInvariant; use codex_protocol::protocol::EpiphanyInvestigationCheckpoint; +use codex_protocol::protocol::EpiphanyJobBackendKind; use codex_protocol::protocol::EpiphanyJobBinding; use codex_protocol::protocol::EpiphanyModeState; use codex_protocol::protocol::EpiphanyObservation; @@ -664,6 +665,15 @@ fn validate_epiphany_job_bindings(job_bindings: &[EpiphanyJobBinding]) -> Vec Vec errors.push(format!( + "job binding {:?} sets backend_kind without backend_job_id", + binding.id + )), + (None, Some(_)) => errors.push(format!( + "job binding {:?} sets backend_job_id without backend_kind", + binding.id + )), + _ => {} + } + if let ( + Some(EpiphanyJobBackendKind::AgentJobs), + Some(backend_job_id), + Some(runtime_agent_job_id), + ) = ( + binding.backend_kind, + binding.backend_job_id.as_deref(), + binding.runtime_agent_job_id.as_deref(), + ) && backend_job_id != runtime_agent_job_id + { + errors.push(format!( + "job binding {:?} sets mismatched agent_jobs ids across backend_job_id and runtime_agent_job_id", + binding.id + )); + } if !binding.id.is_empty() && !seen_ids.insert(binding.id.as_str()) { errors.push(format!("duplicate job binding id {:?}", binding.id)); } @@ -829,6 +865,10 @@ 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_kind: Some(EpiphanyJobBackendKind::AgentJobs), + backend_job_id: Some(format!("agent-job-{id}")), runtime_agent_job_id: Some(format!("agent-job-{id}")), linked_subgoal_ids: vec!["phase-6".to_string()], linked_graph_node_ids: vec!["job-surface".to_string()], @@ -922,6 +962,14 @@ 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].runtime_agent_job_id.as_deref(), Some("agent-job-new") @@ -1092,6 +1140,10 @@ 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_kind: Some(EpiphanyJobBackendKind::AgentJobs), + backend_job_id: Some(String::new()), runtime_agent_job_id: Some(String::new()), linked_subgoal_ids: Vec::new(), linked_graph_node_ids: Vec::new(), @@ -1130,6 +1182,21 @@ mod epiphany_update_tests { .iter() .any(|error| error.contains("job_binding.runtime_agent_job_id 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() @@ -1141,6 +1208,47 @@ mod epiphany_update_tests { .any(|error| error.contains("job_binding.blocking_reason must not be empty")) ); } + + #[test] + fn validate_epiphany_state_update_rejects_incomplete_or_conflicting_job_backend_bindings() { + let update = EpiphanyStateUpdate { + job_bindings: Some(vec![ + EpiphanyJobBinding { + backend_kind: Some(EpiphanyJobBackendKind::AgentJobs), + backend_job_id: None, + ..job_binding("missing-backend-job-id") + }, + EpiphanyJobBinding { + backend_kind: None, + backend_job_id: Some("agent-job-orphan".to_string()), + runtime_agent_job_id: None, + ..job_binding("orphan-backend-job-id") + }, + EpiphanyJobBinding { + backend_kind: Some(EpiphanyJobBackendKind::AgentJobs), + backend_job_id: Some("agent-job-backend".to_string()), + runtime_agent_job_id: Some("agent-job-legacy".to_string()), + ..job_binding("mismatched-ids") + }, + ]), + ..Default::default() + }; + + let errors = + epiphany_state_update_validation_errors(&EpiphanyThreadState::default(), &update); + + assert!(errors.iter().any(|error| { + error.contains("backend_kind without backend_job_id") + && error.contains("missing-backend-job-id") + })); + assert!(errors.iter().any(|error| { + error.contains("backend_job_id without backend_kind") + && error.contains("orphan-backend-job-id") + })); + assert!(errors.iter().any(|error| { + error.contains("mismatched agent_jobs ids") && error.contains("mismatched-ids") + })); + } } fn pending_message_input_item(message: &ResponseItem) -> CodexResult { diff --git a/vendor/codex/codex-rs/protocol/src/protocol.rs b/vendor/codex/codex-rs/protocol/src/protocol.rs index 3466e1f9..00540b55 100644 --- a/vendor/codex/codex-rs/protocol/src/protocol.rs +++ b/vendor/codex/codex-rs/protocol/src/protocol.rs @@ -3309,6 +3309,13 @@ pub enum EpiphanyJobKind { Specialist, } +#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "snake_case")] +#[ts(rename_all = "snake_case")] +pub enum EpiphanyJobBackendKind { + AgentJobs, +} + #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS)] pub struct EpiphanyJobBinding { pub id: String, @@ -3317,6 +3324,18 @@ pub struct EpiphanyJobBinding { pub owner_role: String, #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(type = "string | null")] + pub launcher_job_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub authority_scope: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "EpiphanyJobBackendKind | null")] + pub backend_kind: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] + pub backend_job_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(type = "string | null")] pub runtime_agent_job_id: Option, #[serde(default, skip_serializing_if = "Vec::is_empty")] #[ts(type = "Array")]