interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

[Codex Security] Any enrolled subject can complete another candidate's required work

open 55a8c9b3de64a787 #10 · opened 2026-11-15 17:19 UTC

Imported from GitHub drakestapleton/omega-mv#10, by drakestapleton

Base 91f88c287d7831784a808c5b054818fd9055afb5 · Head e5ade12eb3efe1cf0504335be52596411ef9d3fc

drakestapleton wrote on 2026-11-15 17:19 UTC

Generation work is now candidate-owned and capability-scoped.

  • Bound stores allow only the authenticated candidate proposer to add work or name an explicit delegate.
  • Completion requires the assigned worker’s credential and a live capability scoped to the store, generation, candidate, work ID, and operation.
  • Required evidence must retain the digest captured at authorized completion, so a forged DONE state cannot bypass the drain.
  • Root and receipt formats now commit durable completer and evidence provenance while preserving legacy unbound R9 and visor behavior.

Static Verification Checks

  • Candidate ownership enforced (Passed) — rx_gen_add_work_as in src/runtime/rx_generation.c accepts bound work only from the authenticated candidate proposer.
  • Worker capability revalidated (Passed) — rx_gen_finish_work_as requires the assigned worker and revalidates its exact finish resource before setting DONE.
  • Drain bypass rejected (Passed) — classify compares the captured evidence digest before accepting required completed work, preventing forged drain bypasses.
  • Durable provenance committed (Passed) — R9WORK1, R9ROOT3, and R9RCT03 bind completer identity and evidence digests into recoverable generation records.
  • Legitimate paths preserved (Passed) — tests/runtime/rx_r16_negative.c asserts proposer and delegated completion; unbound R9 and visor callers retain legacy behavior.
  • Static verification scope (Passed) — Repository source and final diff were inspected statically; runtime checks were not performed.
  • Finding: acf_58e26d69618e9869fdb8b37e6de32209

  • Patch: arp_6ac700b2eaac544748fe1f8523a905db
  • Base commit: 91f88c287d7831784a808c5b054818fd9055afb5
  • Patch SHA-256: 2feaef9f49575a1abb2b017840accc2bd766fc7c4b18dce3c4def706684f7635

Apply it

git checkout -b patch-55a8c9b3de64a787 91f88c287d7831784a808c5b054818fd9055afb5
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/55a8c9b3de64a787.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
drakestapleton/omega-mv
10
e5ade12eb3efe1cf0504335be52596411ef9d3fc
{"kind":"github-import","owner":"drakestapleton","repo":"omega-mv","number":10,"url":"https://github.com/drakestapleton/omega-mv/pull/10","export_sha256":"7a4dc05cfaafc4ff4b6c7811f8b55128091a7d4d233c7761f900f26220660f83","imported_utc":"2026-11-18T16:39:50Z"}

Changes

diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index aa4a7bd38..49c137ef7 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -127,6 +127,7 @@ Update this table in the same commit as the work it credits.
 | Claude Opus 5.5 | R15 energy preflight test: the fake package counter (and the falling cpu_p counter of decr3) now ticks every 10 ms until the case finishes instead of on a fixed 0.05/0.15 s schedule, so a preflight that starts late under load still sees it advance; delayed-start repro, 30/30 quiet and 30/30 under pinned busy loops |
 | Codex | Corrected Neuralese historical compiler attribution and separated active reproduction pins from dated run evidence. |
 | Codex | Separated historical gpumath parity and binary-size evidence from current compiler reproduction pins. |
+| Codex | Closed cross-candidate generation-work completion with proposer-controlled delegation, scoped expiring finish capabilities, durable completer/evidence provenance, and adversarial source probes. |
 | Claude Opus 5.5 | Added `target x86efi` on current main: PE32+ output, UEFI entry/exit with callee-saved XMM and MXCSR, the target-scoped `efi` word with the general file operation `efi 12` and console `efi 13`, gate18 coverage of the scoped keyword, and `docs/X86-EFI.md`. Exercised under QEMU/OVMF only (float parity with x86linux and AArch64, efi 12 refusal codes, Read/Write-swap and MXCSR mutants); physical firmware NOT_RUN. |
 | Claude Opus 5.5 | Merged main d3d1b1bc (#1015 x86efi, omc b4f45121) into train r6: kept the gpumath historical provenance and measured `gpumath.om` under be8c5130 and b4f45121 (29,272 bytes, identical sha256); crumbs recompiled with the pinned tool. |
 | Claude Opus 5.5 | Brought `seed/effects` back to PASS on main d3d1b1bc: table rows hold any number of syscalls, added `execpure` (10 syscalls), `peername` (205) and `close_range` (436) for `execprog`, and made the closure read every genkw keyword list by content. |
diff --git a/docs/osc/audit/omega-runtime.md b/docs/osc/audit/omega-runtime.md
index 07a4963f7..87f2feda9 100644
--- a/docs/osc/audit/omega-runtime.md
+++ b/docs/osc/audit/omega-runtime.md
@@ -214,7 +214,7 @@ Format: repository/path | function/type | hazard | current ownership model | cur
 36. omega/src/runtime/rx_coherent.c:88-106 | g_crc lazy init | racy global init | global | process | const table computed at compile time | low | none
 37. omega/src/runtime/rx_resident_gpu.c:137 | emit_overflow | global error flag in codegen | global | process | Result from builder | low | none
 38. omega/src/runtime/rx_fusion.c:675, 899 | g_bench, g_blob | non-reentrant globals | global | process | per-call `own<T>` context | low | none
-39. omega/src/runtime/rx_generation.c:560-565, 515-531 | generation blobs/receipt | persists runtime slot id+generation and cap_id as durable identity | store (disk) | across restarts | `SemanticId<T>` / durable object id; slot handles stay runtime-only | high | on-disk R9 format v2 (ROOT_AUTH_GEN_HI etc.)
+39. omega/src/runtime/rx_generation.c | generation blobs/receipt | persists promotion and work capability generations as durable identity, with root-committed completer/evidence provenance | store (disk) | across restarts | `SemanticId<T>` / durable object id; slot handles stay runtime-only | high | on-disk R9 root/receipt format v3 and R9WORK1 (v1/v2 roots remain readable)
 40. omega/src/visor/visor_evidence.c:29-32, 445-447; tools/omega.c:42-53 | JSON parser + REPL view buffers | large static mutable buffers, non-reentrant | global | process | `own<T>` session context | low | Visor console API
 
 ---
diff --git a/spec/r16-orchestrator-retirement.md b/spec/r16-orchestrator-retirement.md
index 0e06a4220..59810af97 100644
--- a/spec/r16-orchestrator-retirement.md
+++ b/spec/r16-orchestrator-retirement.md
@@ -612,11 +612,17 @@ blocked).
    - Also: the P2 revocation thread's `pthread_join` result is now checked,
      and the flip recheck carries the contract that `rx_gen_bind_authority`
      is startup-only and lock-free.
-   - Limits: any live enrolled subject may add or finish work on any
-     candidate (the credential proves who the caller is, not that it owns
-     the candidate; a proposer-only rule would change the drain contract).
-     A drain callback on a bound store must now use `rx_gen_finish_work_as`;
-     no in-tree bound store uses a drain callback, so that path has no probe.
+   - Follow-up authorization closure (2026-11-15): on a bound store only the
+     authenticated candidate proposer may add work. The proposer either owns
+     the item or explicitly names a delegated worker, and supplies that
+     worker's capability for the store/parent-generation/candidate/work/finish
+     resource returned by `rx_gen_work_resource`. The native authority checks
+     the capability when work is added and again when it is finished, so a
+     revoked, expired, cross-worker or cross-work grant cannot produce DONE.
+     Completion writes a root- and receipt-committed `R9WORK1` blob containing
+     the completer and the digest of the evidence observed at completion.
+     A bound-store drain must therefore run as the assigned worker and use
+     `rx_gen_finish_work_as`; unbound R9 and visor accounting remains legacy.
    - Host ladder rerun after this fix: R7, R8 (116/0), R9, R10 (198/0), R11
      (436/0), R13 host, R14 host (A to F PASS), R15 parity host (5 pairs, 0
      failures), R15 G7 host (57/0), workflow fusion (17059/0; its check count
diff --git a/src/runtime/rx_generation.c b/src/runtime/rx_generation.c
index dff8c965e..d4aaeb2f0 100644
--- a/src/runtime/rx_generation.c
+++ b/src/runtime/rx_generation.c
@@ -37,12 +37,18 @@
 #define ROOT_BYTES 512
 #define ROOT_SUM   480
 #define ROOT_AUTH_GEN_HI 432   /* after the excluded ids, before the sum */
+#define ROOT_WORK_LEN 436
+#define ROOT_WORK_DIGEST 444
+#define ROOT_WORK_COUNT 476
 #define PTR_BYTES  128
 #define PTR_SUM    96
 #define JRN_BYTES  128
 #define JRN_SUM    96
 #define RCT_BYTES  256
 #define RCT_SUM    224
+#define WORK_HEADER_BYTES 16u
+#define WORK_ROW_BYTES    80u
+#define WORK_BLOB_BYTES   (WORK_HEADER_BYTES + RX_GEN_MAX_WORK * WORK_ROW_BYTES)
 #define MAX_BLOB   65536u
 #define MAX_CAND   4
 
@@ -78,6 +84,9 @@ typedef struct {
     uint8_t digest[DIG_COUNT][32];
     uint64_t external_ids[RX_GEN_MAX_EXTERNAL];
     uint64_t excluded_ids[RX_GEN_MAX_EXCLUDED];
+    uint64_t work_len;
+    uint8_t work_digest[32];
+    uint32_t n_work;
 } RootView;
 
 typedef struct {
@@ -260,6 +269,32 @@ static Candidate *find_cand(RxGenStore *store, uint64_t id) {
     return NULL;
 }
 
+static uint64_t work_resource_value(const RxGenStore *store, const Candidate *c,
+                                    uint64_t work_id) {
+    static const uint8_t domain[] = "omega.rx.generation.work.finish.v1";
+    uint8_t ids[24], digest[32];
+    put_u64(ids, c->parent_id);
+    put_u64(ids + 8, c->id);
+    put_u64(ids + 16, work_id);
+    sha256_ctx ctx;
+    sha256_init(&ctx);
+    sha256_update(&ctx, domain, sizeof domain - 1);
+    sha256_update(&ctx, (const uint8_t *)store->dir, strlen(store->dir));
+    sha256_update(&ctx, ids, sizeof ids);
+    sha256_final(&ctx, digest);
+    uint64_t resource = get_u64(digest);
+    return resource ? resource : UINT64_MAX;
+}
+
+int rx_gen_work_resource(const RxGenStore *store, uint64_t candidate, uint64_t work_id,
+                         uint64_t *out_resource) {
+    if (!store || !out_resource) return RX_GEN_ERR_ARG;
+    Candidate *c = find_cand((RxGenStore *)store, candidate);
+    if (!c) return RX_GEN_ERR_ARG;
+    *out_resource = work_resource_value(store, c, work_id);
+    return RX_GEN_OK;
+}
+
 static int copy_blob(uint8_t **dst, size_t *dst_n, const uint8_t *src, size_t n) {
     if (n > MAX_BLOB) return RX_GEN_ERR_ARG;
     uint8_t *p = NULL;
@@ -276,7 +311,7 @@ static int copy_blob(uint8_t **dst, size_t *dst_n, const uint8_t *src, size_t n)
 
 static void encode_root(const RootView *v, uint8_t out[ROOT_BYTES]) {
     memset(out, 0, ROOT_BYTES);
-    memcpy(out, "R9ROOT2", 7);
+    memcpy(out, "R9ROOT3", 7);
     put_u64(out + 8, v->id);
     put_u64(out + 16, v->parent);
     put_u64(out + 24, v->lineage);
@@ -295,13 +330,17 @@ static void encode_root(const RootView *v, uint8_t out[ROOT_BYTES]) {
     for (uint32_t i = 0; i < v->n_excluded && i < RX_GEN_MAX_EXCLUDED; i++)
         put_u64(out + 368 + (size_t)i * 8, v->excluded_ids[i]);
     put_u32(out + ROOT_AUTH_GEN_HI, (uint32_t)(v->authority_generation >> 32));
+    put_u64(out + ROOT_WORK_LEN, v->work_len);
+    memcpy(out + ROOT_WORK_DIGEST, v->work_digest, sizeof v->work_digest);
+    put_u32(out + ROOT_WORK_COUNT, v->n_work);
     checksum(out, ROOT_SUM, out + ROOT_SUM);
 }
 
 static int decode_root(const uint8_t in[ROOT_BYTES], RootView *v) {
-    /* Version 2 keeps the high half of the 64-bit authority generation at
-     * ROOT_AUTH_GEN_HI. Version 1 had none; its high half reads as zero. */
-    int v2 = memcmp(in, "R9ROOT2", 7) == 0;
+    /* Version 2 keeps the high half of the 64-bit authority generation;
+     * version 3 also commits the durable work-completion provenance. */
+    int v3 = memcmp(in, "R9ROOT3", 7) == 0;
+    int v2 = v3 || memcmp(in, "R9ROOT2", 7) == 0;
     if (!v2 && memcmp(in, "R9ROOT1", 7) != 0) return RX_GEN_ERR_TORN;
     uint8_t sum[32];
     checksum(in, ROOT_SUM, sum);
@@ -327,6 +366,14 @@ static int decode_root(const uint8_t in[ROOT_BYTES], RootView *v) {
         v->external_ids[i] = get_u64(in + 304 + (size_t)i * 8);
     for (uint32_t i = 0; i < v->n_excluded; i++)
         v->excluded_ids[i] = get_u64(in + 368 + (size_t)i * 8);
+    if (v3) {
+        v->work_len = get_u64(in + ROOT_WORK_LEN);
+        memcpy(v->work_digest, in + ROOT_WORK_DIGEST, sizeof v->work_digest);
+        v->n_work = get_u32(in + ROOT_WORK_COUNT);
+        if (v->n_work > RX_GEN_MAX_WORK ||
+            v->work_len != WORK_HEADER_BYTES + (uint64_t)v->n_work * WORK_ROW_BYTES)
+            return RX_GEN_ERR_TORN;
+    }
     return RX_GEN_OK;
 }
 
@@ -468,6 +515,11 @@ static int root_reachable(const char *dir, const RootView *view) {
         int rc = file_matches(path, view->digest[i], view->lengths[i]);
         if (rc != RX_GEN_OK) return rc;
     }
+    if (view->work_len) {
+        if (path_join(path, sizeof path, folder, "work") != 0) return RX_GEN_ERR_IO;
+        int rc = file_matches(path, view->work_digest, view->work_len);
+        if (rc != RX_GEN_OK) return rc;
+    }
     return RX_GEN_OK;
 }
 
@@ -544,7 +596,7 @@ static int write_receipt_file(RxGenStore *store, const RootView *view, uint32_t
                               uint32_t cap_id, uint64_t cap_gen) {
     uint8_t raw[RCT_BYTES];
     memset(raw, 0, sizeof raw);
-    memcpy(raw, "R9RCT02", 7);
+    memcpy(raw, "R9RCT03", 7);
     put_u64(raw + 8, view->id);
     put_u64(raw + 16, view->lineage);
     put_u64(raw + 24, view->parent);
@@ -560,6 +612,9 @@ static int write_receipt_file(RxGenStore *store, const RootView *view, uint32_t
     put_u32(raw + 68, cap_id);
     put_u32(raw + 72, (uint32_t)cap_gen);
     put_u32(raw + 76, (uint32_t)(cap_gen >> 32));
+    put_u64(raw + 80, view->work_len);
+    memcpy(raw + 88, view->work_digest, sizeof view->work_digest);
+    put_u32(raw + 120, view->n_work);
     checksum(raw, RCT_SUM, raw + RCT_SUM);
     if (path_join(path, sizeof path, folder, "receipt") != 0) return RX_GEN_ERR_IO;
     return commit_file(store, path, raw, sizeof raw, RX_CRASH_NONE);
@@ -601,6 +656,31 @@ static void hash_buf(const uint8_t *p, size_t n, uint8_t out[32]) {
     sha256_hash(p ? p : (const uint8_t *)"", n, out);
 }
 
+/* R9WORK1 is a root-committed audit record. Every row is fixed-width LE:
+ * id, class, state, required, worker, cap id, completer, cap generation,
+ * scoped finish resource, and the evidence digest observed at completion. */
+static size_t encode_work(const Candidate *c, uint8_t out[WORK_BLOB_BYTES]) {
+    memset(out, 0, WORK_BLOB_BYTES);
+    memcpy(out, "R9WORK1", 7);
+    put_u32(out + 8, c->n_work);
+    put_u32(out + 12, WORK_ROW_BYTES);
+    for (uint32_t i = 0; i < c->n_work; i++) {
+        const RxGenWork *w = &c->work[i];
+        uint8_t *row = out + WORK_HEADER_BYTES + (size_t)i * WORK_ROW_BYTES;
+        put_u64(row, w->id);
+        put_u32(row + 8, w->class);
+        put_u32(row + 12, w->state);
+        put_u32(row + 16, (uint32_t)w->required);
+        put_u32(row + 20, w->worker);
+        put_u32(row + 24, w->finish_cap_id);
+        put_u32(row + 28, w->completer);
+        put_u64(row + 32, w->finish_cap_generation);
+        put_u64(row + 40, w->finish_resource);
+        memcpy(row + 48, w->evidence_digest, sizeof w->evidence_digest);
+    }
+    return WORK_HEADER_BYTES + (size_t)c->n_work * WORK_ROW_BYTES;
+}
+
 static int release_lock(RxGenStore *store) {
     if (store->lock_fd >= 0) {
         close(store->lock_fd);
@@ -664,6 +744,15 @@ static int install_genesis(RxGenStore *store) {
         view.lengths[i] = lens[i];
         hash_buf(blobs[i], lens[i], view.digest[i]);
     }
+    Candidate empty;
+    uint8_t work[WORK_BLOB_BYTES];
+    memset(&empty, 0, sizeof empty);
+    view.work_len = encode_work(&empty, work);
+    view.n_work = 0;
+    hash_buf(work, (size_t)view.work_len, view.work_digest);
+    if (write_named_blob(store, folder, "work", work, (size_t)view.work_len, RX_CRASH_NONE) !=
+        RX_GEN_OK)
+        return RX_GEN_ERR_IO;
     uint8_t root[ROOT_BYTES];
     encode_root(&view, root);
     char root_path[512];
@@ -770,27 +859,31 @@ int rx_gen_read_blob(const RxGenStore *store, uint64_t id, const char *name, uin
     int which = -1;
     for (int i = 0; i < DIG_COUNT; i++)
         if (strcmp(name, BLOB_NAME[i]) == 0) which = i;
-    if (which < 0) return RX_GEN_ERR_ARG;
+    int work = strcmp(name, "work") == 0;
+    if (which < 0 && !work) return RX_GEN_ERR_ARG;
     RootView view;
     uint8_t root_digest[32];
     int rc = load_root_file(store->dir, id, &view, root_digest);
     if (rc != RX_GEN_OK) return rc;
     if (view.id != id) return RX_GEN_ERR_TORN;
-    if (view.lengths[which] > cap) return RX_GEN_ERR_ARG;
+    uint64_t length = work ? view.work_len : view.lengths[which];
+    const uint8_t *digest = work ? view.work_digest : view.digest[which];
+    const char *stored_name = work ? "work" : BLOB_NAME[which];
+    if (length > cap) return RX_GEN_ERR_ARG;
     char folder[512], path[512];
-    /* BLOB_NAME[which], not the caller's string: the name opened is the table's, never the input's */
+    /* stored_name comes from a fixed table/literal, never from the input. */
     if (gen_dir(store->dir, id, folder, sizeof folder) != 0 ||
-        path_join(path, sizeof path, folder, BLOB_NAME[which]) != 0) return RX_GEN_ERR_IO;
-    rc = file_matches(path, view.digest[which], view.lengths[which]);
+        path_join(path, sizeof path, folder, stored_name) != 0) return RX_GEN_ERR_IO;
+    rc = file_matches(path, digest, length);
     if (rc != RX_GEN_OK) return rc;
-    if (view.lengths[which] && read_full(path, buf, (size_t)view.lengths[which]) != 0)
+    if (length && read_full(path, buf, (size_t)length) != 0)
         return RX_GEN_ERR_IO;
     /* The bytes read must be the bytes the root names, not whatever the file
      * became after the check above. */
     uint8_t got[32];
-    hash_buf(buf, (size_t)view.lengths[which], got);
-    if (memcmp(got, view.digest[which], 32) != 0) return RX_GEN_ERR_TORN;
-    *out_len = (size_t)view.lengths[which];
+    hash_buf(buf, (size_t)length, got);
+    if (memcmp(got, digest, 32) != 0) return RX_GEN_ERR_TORN;
+    *out_len = (size_t)length;
     return RX_GEN_OK;
 }
 
@@ -948,7 +1041,31 @@ int rx_gen_add_work_as(RxGenStore *store, uint32_t subject, const RxCallerCred *
      * marks it done, and only classify cancels it. */
     int starts_open = work->state == RX_WORK_PENDING || work->state == RX_WORK_ISSUED;
     if (!starts_open) return RX_GEN_ERR_ARG;
-    c->work[c->n_work++] = *work;
+    for (uint32_t i = 0; i < c->n_work; i++)
+        if (c->work[i].id == work->id) return RX_GEN_ERR_ARG;
+    RxGenWork accepted = *work;
+    accepted.completer = 0;
+    memset(accepted.evidence_digest, 0, sizeof accepted.evidence_digest);
+    accepted.finish_resource = 0;
+    if (store_bound(store)) {
+        /* Candidate ownership authorizes assignment; it does not let an
+         * arbitrary enrolled subject manufacture work for someone else's
+         * candidate. worker_set marks the proposer's explicit delegate. */
+        if (subject != c->proposer) return RX_GEN_ERR_AUTHORITY;
+        accepted.worker = work->worker_set ? work->worker : c->proposer;
+        accepted.worker_set = 1;
+        accepted.finish_resource = work_resource_value(store, c, work->id);
+        int arc = store->bound_auth(store->bound_auth_ctx, work->finish_cap_id,
+                                    work->finish_cap_generation, accepted.worker,
+                                    accepted.finish_resource, RX_GEN_RIGHT_FINISH);
+        if (arc != 0) return RX_GEN_ERR_AUTHORITY;
+    } else {
+        accepted.worker = 0;
+        accepted.worker_set = 0;
+        accepted.finish_cap_id = 0;
+        accepted.finish_cap_generation = 0;
+    }
+    c->work[c->n_work++] = accepted;
     return RX_GEN_OK;
 }
 
@@ -968,7 +1085,20 @@ int rx_gen_finish_work_as(RxGenStore *store, uint32_t subject, const RxCallerCre
     if (!c) return RX_GEN_ERR_ARG;
     for (uint32_t i = 0; i < c->n_work; i++) {
         if (c->work[i].id == work_id) {
-            c->work[i].state = RX_WORK_DONE;
+            RxGenWork *work = &c->work[i];
+            if (store_bound(store)) {
+                uint64_t resource = work_resource_value(store, c, work_id);
+                if (work->worker != subject || work->finish_resource != resource)
+                    return RX_GEN_ERR_AUTHORITY;
+                int arc = store->bound_auth(store->bound_auth_ctx, work->finish_cap_id,
+                                            work->finish_cap_generation, subject, resource,
+                                            RX_GEN_RIGHT_FINISH);
+                if (arc != 0) return RX_GEN_ERR_AUTHORITY;
+            }
+            work->state = RX_WORK_DONE;
+            work->completer = subject;
+            hash_buf(c->blob[DIG_EVIDENCE], c->blob_len[DIG_EVIDENCE],
+                     work->evidence_digest);
             return RX_GEN_OK;
         }
     }
@@ -1022,9 +1152,14 @@ static int classify(RxGenStore *store, Candidate *c, RxGenDrainFn drain, void *d
                     return RX_GEN_ERR_VERIFY;
                 }
                 excluded[(*n_excluded)++] = w->id;
-            } else if (c->blob_len[DIG_EVIDENCE] == 0) {
-                c->draining = 0;
-                return RX_GEN_ERR_VERIFY;
+            } else {
+                uint8_t evidence_digest[32];
+                hash_buf(c->blob[DIG_EVIDENCE], c->blob_len[DIG_EVIDENCE], evidence_digest);
+                if (c->blob_len[DIG_EVIDENCE] == 0 ||
+                    memcmp(evidence_digest, w->evidence_digest, sizeof evidence_digest) != 0) {
+                    c->draining = 0;
+                    return RX_GEN_ERR_VERIFY;
+                }
             }
             continue;
         }
@@ -1164,6 +1299,12 @@ int rx_gen_promote(RxGenStore *store, const RxPromotionRequest *request, RxGenAu
         view.lengths[i] = c->blob_len[i];
         hash_buf(c->blob[i], c->blob_len[i], view.digest[i]);
     }
+    uint8_t work[WORK_BLOB_BYTES];
+    view.work_len = encode_work(c, work);
+    view.n_work = c->n_work;
+    hash_buf(work, (size_t)view.work_len, view.work_digest);
+    rc = write_named_blob(store, folder, "work", work, (size_t)view.work_len, RX_CRASH_NONE);
+    if (rc != RX_GEN_OK) goto done;
     store->phases.blobs_ns = monotonic_ns();
     uint8_t root[ROOT_BYTES];
     encode_root(&view, root);
diff --git a/src/runtime/rx_generation.h b/src/runtime/rx_generation.h
index 9cdd7adab..7b60105b8 100644
--- a/src/runtime/rx_generation.h
+++ b/src/runtime/rx_generation.h
@@ -62,6 +62,9 @@
  * on the authority root; this is the same number. */
 #define RX_GEN_RES_PROMOTION 0x905ull
 #define RX_GEN_RIGHT_PROMOTE 0x200u
+/* Work completion uses an ordinary WRITE capability on a resource derived
+ * from the store, parent generation, candidate, work id and finish operation. */
+#define RX_GEN_RIGHT_FINISH  0x2u
 
 enum {
     RX_WORK_EPHEMERAL = 1,
@@ -120,6 +123,19 @@ typedef struct {
     uint32_t class;
     uint32_t state;
     int required;
+    /* On a bound store, only the candidate proposer may add work. `worker`
+     * names its owner/delegate when worker_set is nonzero (otherwise the
+     * proposer owns it), including when the explicit worker is subject zero.
+     * finish_cap_* names that worker's capability for rx_gen_work_resource.
+     * The remaining fields are runtime-owned completion provenance; input
+     * values are ignored. Unbound stores retain legacy accounting behavior. */
+    uint32_t worker;
+    int worker_set;
+    uint32_t finish_cap_id;
+    uint64_t finish_cap_generation;
+    uint32_t completer;
+    uint64_t finish_resource;
+    uint8_t evidence_digest[32];
 } RxGenWork;
 
 typedef struct {
@@ -164,7 +180,7 @@ typedef struct {
     int result;
     /* Finer stamps inside the barrier (R15 trace, spec §6.7). */
     uint64_t verified_ns;        /* work classified, observations and proofs checked */
-    uint64_t blobs_ns;           /* the six generation blobs written and synced */
+    uint64_t blobs_ns;           /* generation and work-provenance blobs written and synced */
     uint64_t candidate_ns;       /* root and CANDIDATE journal written and synced */
     uint64_t reachable_ns;       /* root re-read from disk and checked */
     uint64_t flipped_ns;         /* FLIPPED journal written and synced */
@@ -188,9 +204,10 @@ int rx_gen_last_phases(const RxGenStore *store, RxGenPhases *out);
 int rx_gen_active(const RxGenStore *store, uint64_t *id, uint64_t *lineage);
 
 /* One blob of committed generation `id` ("evidence", "model", "realization",
- * "config", "provenance" or "objects"), checked against that generation's
- * root: length and SHA-256. A missing root is RX_GEN_ERR_MISSING; a blob that
- * does not match is RX_GEN_ERR_TORN. */
+ * "config", "provenance", "objects" or "work"), checked against that
+ * generation's root: length and SHA-256. The work blob records each item's
+ * owner, scoped capability, completer and evidence digest. A missing root is
+ * RX_GEN_ERR_MISSING; a blob that does not match is RX_GEN_ERR_TORN. */
 int rx_gen_read_blob(const RxGenStore *store, uint64_t id, const char *name, uint8_t *buf,
                      size_t cap, size_t *out_len);
 
@@ -208,11 +225,18 @@ int rx_gen_observe_object(RxGenStore *store, uint64_t candidate, uint32_t index,
                           uint32_t generation);
 int rx_gen_add_work(RxGenStore *store, uint64_t candidate, const RxGenWork *work);
 int rx_gen_finish_work(RxGenStore *store, uint64_t candidate, uint64_t work_id);
+/* Return the exact authority resource for finishing `work_id`. It is scoped
+ * to this store, the candidate's parent generation, candidate and operation.
+ * Call this after proposal and mint/delegate RX_GEN_RIGHT_FINISH to the work's
+ * worker before rx_gen_add_work_as. */
+int rx_gen_work_resource(const RxGenStore *store, uint64_t candidate, uint64_t work_id,
+                         uint64_t *out_resource);
 /* R16 C7: the work-accounting calls present the caller credential. On a bound
  * store the bare rx_gen_add_work and rx_gen_finish_work are refused with
- * RX_GEN_ERR_IDENTITY. Work is added pending or issued only (else
- * RX_GEN_ERR_ARG); only rx_gen_finish_work(_as) marks it done. A drain
- * callback on a bound store must use rx_gen_finish_work_as. */
+ * RX_GEN_ERR_IDENTITY. Only the candidate proposer may add pending/issued
+ * work and name its worker; the worker's scoped, live capability is checked
+ * both when added and when finished. Only rx_gen_finish_work_as marks it done.
+ * A drain callback on a bound store must use the delegated worker credential. */
 int rx_gen_add_work_as(RxGenStore *store, uint32_t subject, const RxCallerCred *cred,
                        uint64_t candidate, const RxGenWork *work);
 int rx_gen_finish_work_as(RxGenStore *store, uint32_t subject, const RxCallerCred *cred,
@@ -231,9 +255,10 @@ int rx_gen_promote(RxGenStore *store, const RxPromotionRequest *request,
  * promotion authority, once (RX_GEN_ERR_BUSY if already bound). From then
  * on: rx_gen_propose_as and rx_gen_promote check the proposer's / the
  * request subject's credential through `caller` before anything else
- * (RX_GEN_ERR_IDENTITY), and rx_gen_promote validates the promotion right
- * with the bound `auth` / `auth_ctx` only: an authority callback passed by the
- * caller is not consulted. There is no unbind. */
+ * (RX_GEN_ERR_IDENTITY). Work assignment/completion validates its scoped
+ * finish capability and rx_gen_promote validates the promotion right with the
+ * bound `auth` / `auth_ctx` only: an authority callback passed by the caller
+ * is not consulted. There is no unbind. */
 /* `op` is RX_CALLER_OP_CHECK, or RX_CALLER_OP_HOLD then RX_CALLER_OP_RELEASE
  * (rx_caller.h): C7, rx_gen_promote checks the request subject again with
  * HOLD right before the active pointer moves, and refuses the flip
diff --git a/tests/runtime/rx_r16_negative.c b/tests/runtime/rx_r16_negative.c
index a413ad28c..6290dac5f 100644
--- a/tests/runtime/rx_r16_negative.c
+++ b/tests/runtime/rx_r16_negative.c
@@ -97,6 +97,7 @@
  */
 #include "rx_r15_rig.h"
 #include "runtime/aienos_cap.h"
+#include "sha256.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -385,6 +386,33 @@ static int permissive_auth(void *ctx, uint32_t cap_id, uint64_t generation, uint
     return 0;
 }
 
+typedef struct {
+    uint32_t cap_id;
+    uint64_t generation;
+    uint32_t worker;
+    uint64_t resource;
+    int checks;
+} WorkAuth;
+
+/* The promotion grant is not the subject of P4. Work grants are accepted
+ * only for the exact worker, capability generation and derived resource the
+ * probe selected, modeling the native root's object/action/lease checks. */
+static int work_auth(void *ctx, uint32_t cap_id, uint64_t generation, uint32_t subject,
+                     uint64_t resource, uint32_t rights) {
+    WorkAuth *a = ctx;
+    if (rights == RX_GEN_RIGHT_PROMOTE)
+        return resource == RX_GEN_RES_PROMOTION ? 0 : -1;
+    if (rights != RX_GEN_RIGHT_FINISH) return -1;
+    a->checks++;
+    return cap_id == a->cap_id && generation == a->generation && subject == a->worker &&
+                   resource == a->resource ? 0 : -1;
+}
+
+static uint32_t work_u32(const uint8_t *p) {
+    return (uint32_t)p[0] | ((uint32_t)p[1] << 8) | ((uint32_t)p[2] << 16) |
+           ((uint32_t)p[3] << 24);
+}
+
 static void fill_random(uint8_t *p, size_t n) {
     size_t k = 0;
     while (k < n) {
@@ -764,17 +792,19 @@ static int drain_never(uint64_t work_id, void *ctx) {
 }
 
 static void probe_work(Tally *t) {
-    enum { PROP = 7401, PRO = 7402 };
-    static RxCallerCred prop, pro;
+    enum { PROP = 7401, PRO = 7402, WORKER = 7403 };
+    static RxCallerCred prop, pro, worker;
+    WorkAuth auth = {0};
     char dir[64];
     RxGenStore *g = NULL;
     RxWorld *w = scratch_world(permissive_world, NULL);
     int ok = w && rx_world_enroll_caller(w, PROP, &prop) == RX_CALLER_OK &&
              rx_world_enroll_caller(w, PRO, &pro) == RX_CALLER_OK &&
+             rx_world_enroll_caller(w, WORKER, &worker) == RX_CALLER_OK &&
              rx_world_bind_callers(w) == RX_OK &&
              mkdtemp(strcpy(dir, "/tmp/r16-work-XXXXXX")) &&
              rx_gen_open(dir, &g) == RX_GEN_OK &&
-             rx_gen_bind_authority(g, rx_world_caller_check_fn, w, permissive_auth, NULL) ==
+             rx_gen_bind_authority(g, rx_world_caller_check_fn, w, work_auth, &auth) ==
                  RX_GEN_OK;
     expect(t, ok, 1, "C7 P4: scratch world and bound store");
     if (!ok) goto out;
@@ -790,8 +820,8 @@ static void probe_work(Tally *t) {
     /* v0 baseline: an unfinished required item refuses the promotion.
      * v1 attack: nobody completes it with the bare call.
      * v2 attack: the proposer inserts it already done.
-     * v3 attack: the bare insert on a bound store; forged credentials.
-     * v4 control: the proposer adds it and completes it with its credential.
+     * v3 attack: bare, forged, cross-subject and cross-work-capability calls.
+     * v4 control: proposer-owned and explicitly delegated work both complete.
      * The control runs first: a refused candidate keeps its slot (4 in all). */
     static const int order[5] = {4, 0, 1, 2, 3};
     for (int k = 0; k < 5; k++) {
@@ -799,10 +829,21 @@ static void probe_work(Tally *t) {
         uint64_t cand = 0, a0 = 0, l0 = 0, a1 = 0, l1 = 0;
         int drains = 0;
         int prc = rx_gen_propose_as(g, PROP, &prop, &gd, &cand);
-        RxGenWork item = {100 + (uint64_t)v, RX_WORK_EVIDENCE, RX_WORK_PENDING, 1};
+        RxGenWork item = {.id = 100 + (uint64_t)v, .class = RX_WORK_EVIDENCE,
+                          .state = RX_WORK_PENDING, .required = 1};
+        item.finish_cap_id = 900 + (uint32_t)v;
+        item.finish_cap_generation = 70 + (uint64_t)v;
+        uint64_t item_resource = 0;
+        int rrc = prc == RX_GEN_OK
+                    ? rx_gen_work_resource(g, cand, item.id, &item_resource) : prc;
+        auth.cap_id = item.finish_cap_id;
+        auth.generation = item.finish_cap_generation;
+        auth.worker = PROP;
+        auth.resource = item_resource;
         int arc = RX_GEN_OK, frc = RX_GEN_OK;
         if (prc == RX_GEN_OK && v != 2) arc = rx_gen_add_work_as(g, PROP, &prop, cand, &item);
-        expect(t, prc == RX_GEN_OK && arc == RX_GEN_OK, 1, "C7 P4: propose and add the item");
+        expect(t, prc == RX_GEN_OK && rrc == RX_GEN_OK && arc == RX_GEN_OK, 1,
+               "C7 P4: propose, scope and add the item");
         if (v == 1) {
             frc = rx_gen_finish_work(g, cand, item.id);
             expect(t, frc, RX_GEN_ERR_IDENTITY,
@@ -819,9 +860,22 @@ static void probe_work(Tally *t) {
             expect(t, rx_gen_add_work_as(g, PROP, &prop, cand, &item), RX_GEN_OK,
                    "C7 P4: the item added pending");
         } else if (v == 3) {
-            RxGenWork more = {200, RX_WORK_EVIDENCE, RX_WORK_PENDING, 0};
+            RxGenWork more = {.id = 200, .class = RX_WORK_EVIDENCE,
+                              .state = RX_WORK_PENDING, .required = 0};
+            more.finish_cap_id = item.finish_cap_id;
+            more.finish_cap_generation = item.finish_cap_generation;
+            uint64_t more_resource = 0;
+            expect(t, rx_gen_work_resource(g, cand, more.id, &more_resource) == RX_GEN_OK &&
+                          more_resource != item_resource,
+                   1, "C7 P4: derive a distinct sibling work resource");
             expect(t, rx_gen_add_work(g, cand, &more), RX_GEN_ERR_IDENTITY,
                    "C7 P4: rx_gen_add_work (no credential) on a bound store");
+            expect(t, rx_gen_add_work_as(g, PRO, &pro, cand, &more), RX_GEN_ERR_AUTHORITY,
+                   "C7 P4: another subject adds work to the candidate");
+            expect(t, rx_gen_add_work_as(g, PROP, &prop, cand, &more), RX_GEN_ERR_AUTHORITY,
+                   "C7 P4: a capability for one work id is reused for another");
+            expect(t, rx_gen_finish_work_as(g, PRO, &pro, cand, item.id),
+                   RX_GEN_ERR_AUTHORITY, "C7 P4: another subject finishes the proposer's work");
             expect(t, rx_gen_add_work_as(g, PROP, &forged, cand, &more), RX_GEN_ERR_IDENTITY,
                    "C7 P4: rx_gen_add_work_as with a forged credential");
             expect(t, rx_gen_finish_work_as(g, PROP, &forged, cand, item.id),
@@ -829,6 +883,23 @@ static void probe_work(Tally *t) {
         } else if (v == 4) {
             frc = rx_gen_finish_work_as(g, PROP, &prop, cand, item.id);
             expect(t, frc, RX_GEN_OK, "C7 P4 control: the proposer completes its item");
+            RxGenWork delegated = {.id = 204, .class = RX_WORK_EVIDENCE,
+                                   .state = RX_WORK_PENDING, .required = 1};
+            delegated.worker = WORKER;
+            delegated.worker_set = 1;
+            delegated.finish_cap_id = 1204;
+            delegated.finish_cap_generation = 94;
+            uint64_t delegated_resource = 0;
+            expect(t, rx_gen_work_resource(g, cand, delegated.id, &delegated_resource),
+                   RX_GEN_OK, "C7 P4 control: derive the delegated work resource");
+            auth.cap_id = delegated.finish_cap_id;
+            auth.generation = delegated.finish_cap_generation;
+            auth.worker = WORKER;
+            auth.resource = delegated_resource;
+            expect(t, rx_gen_add_work_as(g, PROP, &prop, cand, &delegated), RX_GEN_OK,
+                   "C7 P4 control: proposer delegates its required work");
+            expect(t, rx_gen_finish_work_as(g, WORKER, &worker, cand, delegated.id), RX_GEN_OK,
+                   "C7 P4 control: delegated worker completes its item");
         }
         rx_gen_active(g, &a0, &l0);
         RxPromotionRequest req = {cand, PRO, 1, 1, RX_GEN_RES_PROMOTION,
@@ -840,8 +911,8 @@ static void probe_work(Tally *t) {
         static const char *const name[5] = {"baseline, item unfinished",
                                             "item completed with no credential",
                                             "item offered already done",
-                                            "bare and forged work calls",
-                                            "control, item completed by the proposer"};
+                                            "bare, forged and cross-subject work calls",
+                                            "control, proposer and delegate complete their items"};
         char what[160];
         if (v < 4) {
             snprintf(what, sizeof what, "C7 P4: promotion, %s", name[v]);
@@ -849,6 +920,23 @@ static void probe_work(Tally *t) {
             expect(t, a1 == a0, 1, "C7 P4: active generation unchanged");
         } else {
             expect(t, rc == RX_GEN_OK && a1 == cand, 1, "C7 P4 control: promotion succeeds");
+            uint8_t work_blob[2048] = {0}, digest[32];
+            size_t work_len = 0;
+            int wrc = rx_gen_read_blob(g, cand, "work", work_blob, sizeof work_blob, &work_len);
+            sha256_hash(junk, sizeof junk - 1, digest);
+            const uint8_t *own = work_blob + 16;
+            const uint8_t *deleg = own + 80;
+            expect(t, wrc == RX_GEN_OK && work_len == 176 &&
+                          memcmp(work_blob, "R9WORK1", 7) == 0 && work_u32(work_blob + 8) == 2,
+                   1, "C7 P4 control: root-committed work provenance blob");
+            expect(t, work_u32(own + 20) == PROP && work_u32(own + 28) == PROP &&
+                          memcmp(own + 48, digest, sizeof digest) == 0,
+                   1, "C7 P4 control: proposer completion provenance");
+            expect(t, work_u32(deleg + 20) == WORKER && work_u32(deleg + 28) == WORKER &&
+                          memcmp(deleg + 48, digest, sizeof digest) == 0,
+                   1, "C7 P4 control: delegated completion provenance");
+            expect(t, auth.checks >= 4, 1,
+                   "C7 P4 control: work capabilities checked at assignment and completion");
         }
         printf("R16 C7 P4 %s: promote rc %d; generation %llu -> %llu; drain calls %d\n",
                name[v], rc, U(a0), U(a1), drains);
@@ -856,7 +944,7 @@ static void probe_work(Tally *t) {
 out:
     if (g) rx_gen_close(g);
     scratch_world_free(w);
-    rx_caller_wipe(&prop); rx_caller_wipe(&pro);
+    rx_caller_wipe(&prop); rx_caller_wipe(&pro); rx_caller_wipe(&worker);
 }
 
 static int review_probes(void) {
diff --git a/tests/runtime/rx_r9_barrier.c b/tests/runtime/rx_r9_barrier.c
index e324e35f8..bbd4e7c07 100644
--- a/tests/runtime/rx_r9_barrier.c
+++ b/tests/runtime/rx_r9_barrier.c
@@ -306,7 +306,8 @@ static int child_crash(const char *dir, int step) {
     draft.n_objects = 1;
     uint64_t id = 0;
     if (rx_gen_propose(store, SUBJ_PROPOSER, &draft, &id) != RX_GEN_OK) return 5;
-    RxGenWork effect = {42, RX_WORK_EXTERNAL, RX_WORK_ISSUED, 0};
+    RxGenWork effect = {.id = 42, .class = RX_WORK_EXTERNAL,
+                        .state = RX_WORK_ISSUED, .required = 0};
     if (rx_gen_add_work(store, id, &effect) != RX_GEN_OK) return 6;
     rx_gen_set_crash(store, step);
     RxPromotionRequest req = request_for(id, SUBJ_AUTHORITY, cap);
@@ -519,10 +520,14 @@ static void negative_and_live(void) {
     CHECK(rx_gen_propose(store, SUBJ_PROPOSER, &draft, &first) == RX_GEN_OK, "first candidate");
     CHECK(rx_gen_propose(store, SUBJ_PROPOSER, &draft, &second) == RX_GEN_OK, "second candidate");
     g_cand = first;
-    RxGenWork ephemeral = {1, RX_WORK_EPHEMERAL, RX_WORK_PENDING, 0};
-    RxGenWork optional = {7, RX_WORK_EVIDENCE, RX_WORK_PENDING, 0};
-    RxGenWork required = {3, RX_WORK_EVIDENCE, RX_WORK_PENDING, 1};
-    RxGenWork effect = {11, RX_WORK_EXTERNAL, RX_WORK_ISSUED, 0};
+    RxGenWork ephemeral = {.id = 1, .class = RX_WORK_EPHEMERAL,
+                           .state = RX_WORK_PENDING, .required = 0};
+    RxGenWork optional = {.id = 7, .class = RX_WORK_EVIDENCE,
+                          .state = RX_WORK_PENDING, .required = 0};
+    RxGenWork required = {.id = 3, .class = RX_WORK_EVIDENCE,
+                          .state = RX_WORK_PENDING, .required = 1};
+    RxGenWork effect = {.id = 11, .class = RX_WORK_EXTERNAL,
+                        .state = RX_WORK_ISSUED, .required = 0};
     CHECK(rx_gen_add_work(store, first, &ephemeral) == RX_GEN_OK, "ephemeral");
     CHECK(rx_gen_add_work(store, first, &optional) == RX_GEN_OK, "optional evidence");
     CHECK(rx_gen_add_work(store, first, &required) == RX_GEN_OK, "required evidence");
diff --git a/tests/visor/test_visor_authority.c b/tests/visor/test_visor_authority.c
index 351977859..ec5ecd96e 100644
--- a/tests/visor/test_visor_authority.c
+++ b/tests/visor/test_visor_authority.c
@@ -224,7 +224,8 @@ static int record_committed_effect(Env *e, const char *dir, uint64_t effect_id)
     uint64_t cand = 0;
     int rc = rx_gen_propose(store, SUBJ_PROPOSER, &d, &cand);
     if (rc == RX_GEN_OK) {
-        RxGenWork work = { effect_id, RX_WORK_EXTERNAL, RX_WORK_ISSUED, 0 };
+        RxGenWork work = {.id = effect_id, .class = RX_WORK_EXTERNAL,
+                          .state = RX_WORK_ISSUED, .required = 0};
         rc = rx_gen_add_work(store, cand, &work);
     }
     if (rc == RX_GEN_OK) {