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

fix(authority): close descriptors on store write and fsync failures

merged fcede9b0c62d04d5 #688 · opened 2026-10-24 09:33 UTC · closed 2026-11-06 04:06 UTC · merged 2026-11-06 04:06 UTC

Imported from GitHub aien-dev/omega-mv#688, by drakestapleton

Base 1fc46e2dbe938b5f560cd1846b88f61c34c3a1bf · Head 101823e564edae9c3d2102388a22e27cd5238bd5

Merged on GitHub as 0f442d0641ff9b8a9a958b431520ec2f5109323c; reachable from main c7acd2607139eedfabeac16b6042cefe8ede431f (observed 2026-11-18T16:35:46Z)

drakestapleton wrote on 2026-10-24 09:33 UTC

Evidence 2026-10-31 (AuthStack2 lane, head 101823e564edae9c3d2102388a22e27cd5238bd5)

New commit 101823e5 (docs only: seed/authority/README.md, seed/qualification/security673/README.md, crumbs) records the native runs below. Compiler seed/out/omc sha256 7a8b84fcc07808a52e6cbb65aa7450c754b3ad62eeddf9ec64cc0edd0938b2de, reproduced by sh seed/omega-from-seed.sh (rc 0, seed/out unchanged). All runs taskset -c 6-9,15-19 nice -n 19 ionice -c3, Linux AArch64 host. Logs /tmp/prfix/AuthStack2-logs/688/.

MEASURED:

  • Derivation check: the README derivation table (fopen/write/fsync/fclose/renames to cfopen/cwrite/cfsync/cfclose/crenames, note lines skipped, leftover effect tokens rejected) applied to this head's store.om plus store-cleanup-test.om is byte-identical to the committed store-cleanup-gate.om.
  • Positive: committed gate compile rc 0 (binary sha256 9e32929ad2500f16...), run rc 0, store cleanup cases=18 fails=0. The head-derived gate gives the same binary and output.
  • Pre-fix negative control: same derivation applied to store.om at 95529421 (differs only by the four missing cleanup = cfclose int fd lines): compile rc 0 (binary sha256 577f3203f1e314bc...), run rc 1, stdout and stderr empty. The gate prints no per-case lines by design (store-cleanup-test.om increments cfails and returns 1). The same binary sha256 is produced independently by #769's exact-source mutator (mode 3).
  • gate669 rc 0, 511 lines, GATE669 PASS bounded Linux AArch64 execution and independent decoding only; dispatch-order, store-exact and store-cleanup steps each exit=0 expected=0.
  • crumb verify OK 184 (before and after commit); zero-disk-secrets rc 0; om-units rc 0 (12 PASS lines, BLAKE3-PARITY PASS).
  • Hosted CI at 101823e5: AIEN Checks pass, evidence-immutable pass, om-units pass, AIEN Alpha skipping.

Correction to the block below: the claim that omc 7a8b84fc compiles the gate "without #769's cbadcase split" is wrong. This branch already carries cbadcase, introduced in merge 8af117d7 (its message says it took the helper from #769). The pre-split gate from 08bd7aa7 still fails under 7a8b84fc with omc: line 274: error 12 (MEASURED on #769 at d4f91b6d).

NOT_RUN: hardware security qualification, real syscall failure injection (cleanup uses effect doubles), power loss, production revocation fencing. NOT_RUN is not PASS. Draft; parent #687 not merged.


Evidence 2026-10-31 (AuthStack lane, head e1653b2d0b3c5134d573b923f09f9d907b59600e)

Classification vs main 1db94162 (#970): NOT_CONTAINED. #970 squash-merged fix/security673-qualified (head 03ec4baf, tree 0d4d15a9 == main tree); every commit this stack inherited from it (dd6c4ad7 and earlier) is an ancestor of 03ec4baf and is on main. The stack's own changes are not on main (main seed/authority/dispatch.om still calls readrec before lacq; lock.om lrm returns 0 on unlink failure; no store-exact/store-cleanup/dispatch-order gates on main). Base stays as is (parent not merged). Compiler: seed/out/omc sha256 7a8b84fcc07808a52e6cbb65aa7450c754b3ad62eeddf9ec64cc0edd0938b2de, reproduced by sh seed/omega-from-seed.sh (rc 0, no diff). All runs under taskset -c 6-9,15-19 nice -n 19 ionice -c3, Linux AArch64 host (DGX Spark), repo root as cwd. Helper /tmp/prfix/AuthStack-qual.sh; logs /tmp/prfix/AuthStack-logs/<N>/.

Merged updated #687. Conflicts: .crumb (parent side + recompile), seed/authority/README.md (wired statement + native store-exact results), gate669.om: main renumbered authority ids to 26..32 and removed the segment gate, so the three new gates are appended to main's names table as ids 33..35 (run by authiso) and the obsolete tracegate fn is dropped. Resolved file differs from main's gate669 by 73 changed lines, the same count as this PR's own gate669 diff. MEASURED: store-cleanup-gate store cleanup cases=18 fails=0 exit 0 (the new omc 7a8b84fc compiles it without #769's cbadcase split); store 77, dispatch 37 exit 0; gate669 exit 0 PASS, 511 log lines, the three new authiso steps each exit=0 expected=0 (log lines 409-426); crumb verify OK 184.

NOT_RUN: store-cleanup pre-fix negative control (needs the manual derivation of store.om from 95529421); zero-disk-secrets and om-units on this head; hosted CI pending at push. NOT_RUN is not PASS. Host AArch64 runs are not hardware qualification.


Verification and current posture

PASS (source/host checks only): whitespace, identifier bounds, exact reviewed five-prefix store derivation, unchanged test suffix, four-close negative-control source delta, independent coordinator/path review and pinned crumb verification (157 current). Path construction was checked against a host model, not executed by Omega.

NOT_RUN: Omega compilation, native positive/negative controls, real syscalls/durability, complete native/security qualification and signed Spark evidence. This remains a draft. No compiler/runtime PASS, issue closure, promotion or deployment is claimed.

Bounded correction

writerec returned 11/12 and writegen returned 41/42 on write/fsync failure without closing their descriptor. Add one best-effort fclose on each of four error paths. Preserve primary errors, successful-path close errors and no-close-retry behavior.

The handwritten .om 18-case effect-double regression checks errors, descriptor identity and effect order. The committed .om gate contains a reviewed test-only derivation of store.om. The temporary shell composer is removed from active source to match the new-first-party-.om posture. Current manual derivation/replay instructions are in seed/authority/README.md; historical preparation evidence is preserved, not rewritten.

Wire dispatcher-order, exact-read and cleanup gates into existing gate669 using its compile/run/reap path. Each new gate gets a fresh 0700 child working directory with an absolute executable path captured before chdir; this fixture separation is not a sandbox. Existing gates remain.

Stacked on #687 head 95529421e9a0e6d6d63ca5d8b8cdfaf443e0ef78. No shared compiler, production trust policy, historical evidence, installation or deployment changes.

Refs #649, #670, #671, #673. Candidate 08bd7aa7d7b73864e56163772ccceaa9cc91de0b, tree cd4d3c41888e92ca328a878a4cf21df800cfad04. Source-only review: evidence/SECURITY-673/authority-coordinator/REVIEW.md and store-write-cleanup/REVIEW.md. Required native gates must pass before merge.

drakestapleton wrote on 2026-10-24 10:49 UTC

Updated to 08bd7aa7d7b73864e56163772ccceaa9cc91de0b. Active source is now .om-only for this new regression path: temporary shell composer removed, exact manual derivation documented, and all three regressions wired into the existing gate669 coordinator with separate fresh child fixture directories. Source/model and pinned crumb checks passed; native compilation and controls remain NOT_RUN. Readback: evidence-immutable PASS; AIEN Verification reports no signed Spark bundle for this exact SHA. This remains a draft, not a merge or security-qualification claim.

drakestapleton wrote on 2026-10-24 15:22 UTC

Exact-head Spark receipt, 2026-10-24 15:10 UTC: real FAIL, not missing-bundle NOT_RUN

At the unchanged current PR head 08bd7aa7d7b73864e56163772ccceaa9cc91de0b, the receipts publication includes the signed bundle, for repository=github.com/aien-dev/omega, executor.class=spark. Spark execution finished 15:05:57Z. Its SHA-256 is 5758fc432a5d94e6bd0724c4cc43474681bf51a8d9ac6988a65952bcc8ee163e.

The signed plan/check matrix contains 52/52 required checks: 48 PASS, 3 FAIL (OMEGA-M19 on GB10; OMEGA-R11-OWN-HOLD and OMEGA-R13-TESTBUILD-HOST on host), and 1 BLOCKED_OPERATOR (OMEGA-NUMERIC-TRANSC-FULL). plan.reason=UNMAPPED_PATH also names 193 unclassified paths, including 192 under seed/ and MIGRATION.md. Hosted exact-head verification fetched the real bundle and returned verify-bundle exit 1 (FAIL), not exit 2 NOT_RUN/404 or 3 REJECTED. The known earlier missing-bundle PR comment is superseded by this result.

Route, preserving existing ownership:

  1. Obtain the corresponding actual gate stdout/stderr and exact installed worker/physics pin/machine state from existing operator evidence, keyed by the bundle's receipt hashes. A verdict/digest alone cannot prove why a gate failed. Do not classify R13 or M19 as a defect in this PR without differential evidence.
  2. Route shared M19 silicon/channel qualification to existing Omega #523. Route R11 and R13 host gate review to existing Omega #598, cross-checking the independently observed host-failure patterns of #525/#531. The R13 TESTBUILD HOST failure is additional in this #688 bundle. Keep NOT_RUN cpu_busy distinct from true PASS and real FAIL.
  3. Route the 193 path classifications to the existing gate-graph/mapping owner, coordinating Omega #524; do not silently whitelist the new .om seed tree, remove required checks or change protected pipeline configuration to manufacture a green run. Any actual trust-surface change needs its established operator approval and fresh exact-head signed qualification.
  4. Keep this stacked authority fix DRAFT until native compilation and its dedicated descriptor-close positive/refusal/cleanup controls run, an independent final-current-head review is complete, and any repaired head has its own validated signed evidence. Owner may qualify under existing lease/worker; no duplicate polling workers, blanket hosted reruns, Spark service restart, Renda restart or deployment.

This is evidence/repair routing only, not an implementation takeover, merge approval or live-inference result.

Fetch it

A git bundle of the pull request's head, 26743 bytes.

curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/fcede9b0c62d04d5.bundle -o fcede9b0c62d04d5.bundle
git fetch fcede9b0c62d04d5.bundle refs/pull/688/head

Raw bundle · Diff

Provenance

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

github-import 1
aien-dev/omega-mv
688
101823e564edae9c3d2102388a22e27cd5238bd5
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":688,"url":"https://github.com/aien-dev/omega-mv/pull/688","export_sha256":"7319147b350ad908bf0b731068ec3be7b8dee848041dc862f71455e8e4680140","imported_utc":"2026-11-18T16:35:46Z"}

Changes

diff --git a/.crumb b/.crumb
index 196b83fab..a9925bd0a 100644
--- a/.crumb
+++ b/.crumb
@@ -108,14 +108,14 @@
         }
       ],
       "children_root": "sha256:4b14d5958f47b6630055cf4a2246a89549620f97b64495ebf50844cac8cae2f9",
-      "compiled_at": "2026-10-31T05:03:36Z",
+      "compiled_at": "2026-10-31T05:08:48Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:4852afebbd50704c45de5523ee5ea12c4a022633bbdf191f67f257e731decc21",
-      "evidence_files": 14992,
-      "evidence_root": "sha256:af2893ddec374ff41e6ac67782c79466fd24e2968169bb97988bd8b02ae16c23",
-      "files": 23189,
-      "generated_at_commit": "7e38ee6f352002e180b2932afbca8e281b42bea0",
-      "source_tree": "sha256:f2dad2afe172d68e61cfccdecb406153892438f6754fabdf63cb92b6cad3e86c"
+      "digest": "sha256:8a2a82bcab8a038b1a281e90e74283e3905141cede4d2ed8cb184d9fbf2b4ab6",
+      "evidence_files": 14994,
+      "evidence_root": "sha256:aea371e2df8f9da01b5d1ec77c6a09e115335acff74162f3954ff0a5946ce9ab",
+      "files": 23193,
+      "generated_at_commit": "e1653b2d0b3c5134d573b923f09f9d907b59600e",
+      "source_tree": "sha256:3a4291ba863a107e03d3cb570f5734ee90cda2927978228cf6a1569d690ff4c3"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/evidence/SECURITY-673/authority-coordinator/REVIEW.md b/evidence/SECURITY-673/authority-coordinator/REVIEW.md
new file mode 100644
index 000000000..9c38b10c8
--- /dev/null
+++ b/evidence/SECURITY-673/authority-coordinator/REVIEW.md
@@ -0,0 +1,81 @@
+# Authority regressions in the existing security coordinator
+
+Source-only review, 2026-10-24. Publication base:
+`f4fbb2a7f1419ac49e890a1b8c37f20af02dac38` (stacked #688).
+
+## Change and boundary
+
+`seed/qualification/security673/gate669.om` adds the three existing committed
+regressions at name IDs 34–36, without renumbering the preceding 33 entries:
+
+| Gate | Expected child output | Expected exit |
+| --- | --- | --- |
+| dispatch-order | `dispatch order checks=3 fails=0` | 0 |
+| store-exact | `store exact checks=4 fails=0` | 0 |
+| store-cleanup | `store cleanup cases=18 fails=0` | 0 |
+
+The same twice-rebuilt compiler, artifact checks, fork/exec launcher, wait-status
+checks and deadline handle these children. There is no new runner or production
+implementation. Compiler, production authority/store/lock code, trust policy,
+signing and previous evidence files are unchanged. Existing owner integration
+(L408 and Renda review) is retained.
+
+Each new run gets an exclusively created mode-0700 numbered directory inside
+fresh coordinator scratch. Only its child changes directory, so malformed
+store-exact outputs and other fixtures cannot contaminate the other regressions
+or earlier authority fixtures. Existing gates keep their prior behavior.
+The compiler artifact is passed as an absolute path, assembled before chdir
+from the checked kernel cwd result and the exact artifact ID. Stdio is opened
+before child chdir. The parent never changes directory. Failed directory
+creation or path/packet bounds stop the coordinator. Failed child chdir exits
+97 before execution; failed exec exits 98; both differ from expected 0.
+
+This is trusted fixture/evidence separation, not a sandbox, race-proof file
+pinning, general process-tree limit or concurrent-store qualification. The
+new positive regressions do not intentionally spawn effect children. Existing
+standalone negative-control procedures are not added to the coordinator.
+
+## Source verification performed
+
+- Existing IDs 1–33 retained exactly; new entries and `authiso` calls match.
+- Dispatch and dispatch-order committed gates match their documented source
+  concatenations byte for byte; store and store-exact also match.
+- Store-cleanup matches the documented five-prefix derivation of `store.om`
+  followed by the current handwritten test verbatim. The temporary shell
+  composer is removed; current derivation and replay instructions are in the
+  authority README, not the historical preparation report.
+- Global/text/parameter/local names obey the eight-byte bound, function names
+  the 63-byte bound, parameters the six-argument bound, and blocks balance.
+- New functions use scalar custom parameters, not global-array-to-view calls.
+  Register capacity is inspected against the compiler's 16-slot profile,
+  not proven by compilation.
+- Existing compile/enable and expected-exit/reap failure paths are preserved.
+  Child-only cwd and fail-before-exec ordering were independently reviewed
+  against the existing host `cwd`/`chdir` implementation and test contracts.
+- A host model of the reverse-copy and packet packing checked 40,950 combinations
+  of cwd lengths 1–4095 and numbered artifact widths: 40,614 exact-target accepted
+  cases and 336 capacity refusals. This is an algorithm/source check, not execution
+  of the `.om` implementation. Independent review repeated a boundary model.
+- Whitespace checks pass. Independent source review found no blocking defect.
+
+The pinned crumb tool is the previously inspected host metadata utility from
+`d0f0b95d344b4c6628c3d868346932fd247ce168`, not an Omega compiler. Structural
+compile/verify passed (157 crumbs, only the root rewritten); the root metadata's evidence
+count/root changes for this new report, without rewriting historical evidence.
+
+## Not run and required replay
+
+Omega compilation, all native positive/negative executions, the full coordinator
+and independent Linux AArch64 replay remain **NOT_RUN**. The source-only posture adjustment removes the shell composer without changing
+production sources. No bundled Omega native
+binary was executed, and no compiler/toolchain or GPU dependency was installed.
+Keep draft; source checks and metadata do not establish functional qualification.
+
+On the approved Linux AArch64 qualification host, follow the existing
+`seed/qualification/security673/README.md` reconstruction and full-gate recipe,
+running each step only after its predecessor succeeds and using fresh scratch.
+The full gate must exit 0 and include the three listed child results and retained
+private fixture directories. The existing coordinator negative controls 0/1/2
+must still fail with 99 (not a crash), each with fresh scratch. Replay each
+regression's documented old-source control separately; failed compilation,
+signal or timeout is INVALID, not a successful negative control.
diff --git a/evidence/SECURITY-673/store-write-cleanup/REVIEW.md b/evidence/SECURITY-673/store-write-cleanup/REVIEW.md
new file mode 100644
index 000000000..613f67925
--- /dev/null
+++ b/evidence/SECURITY-673/store-write-cleanup/REVIEW.md
@@ -0,0 +1,97 @@
+# Store write descriptor cleanup: source-only candidate
+
+Publication base: `95529421e9a0e6d6d63ca5d8b8cdfaf443e0ef78` (#687).
+Historical preparation base: `19948824fea22e66499af02f27feef3ce9efa5d9`.
+Review date: 2026-10-24. Scope: authority store (#649/#670), #673 tracker.
+
+## Defect and minimal correction
+
+After a successful open, `writerec` returned 11 (failed/short write) or 12 (failed
+fsync), and `writegen` returned 41 or 42, without closing the descriptor. Each
+of those four paths now makes exactly one best-effort `fclose` call before
+returning its original error. A secondary close error must not mask the primary
+write/fsync error. No close retry is introduced: a failed close may already have
+released the descriptor. Existing successful-write close errors remain 13/43;
+record rename remains unreachable after any earlier failure.
+
+No compiler, runtime implementation, ABI, store format, lock protocol, durability
+claim, temporary-file removal, or historical receipt is changed. This does not
+repair partial generation writes or guarantee cleanup if the process is killed.
+
+## Deterministic source-level regression
+
+`store-cleanup-test.om` is handwritten Omega. `store-cleanup-source.sh` composes
+it with the real store source after mechanically renaming only five write-side
+The composer uses portable awk token matching, rejects unexpected write-side
+effect argument prefixes, and buffers output until source transformation and
+harness reading both succeed. It does not rely on GNU sed word boundaries or
+a pipeline that could mask a source-read failure.
+primitive call prefixes to its effect doubles. Global buffer arguments are omitted because ordinary Omega functions cannot accept
+global arrays; buffer contents are not under test. There are no production test hooks or
+copied writer implementations. `read` remains real but the read functions are
+never called. The fixture opens no real files; its final success message uses
+real stdout. This is a control-flow/error-precedence test, NOT a real syscall,
+fd-leak, persistence, concurrency, Linux, or hardware qualification.
+
+Eighteen cases cover both writers and nine modes: open failure, negative write,
+short write, fsync failure, close failure, success, write plus close failure,
+fsync plus close failure, rename failure (the generation writer does not rename).
+Each asserts the return code, exact ordered effect trace, and that every
+write/sync/close receives the successfully opened fake fd 7. Traces distinguish
+zero/one/multiple closes, skipped effects and unwanted rename. Open failure has
+no close. Primary failures survive a simultaneous close failure.
+
+In a disposable Linux AArch64 checkout, after approval of the reconstructed
+compiler and its prerequisites:
+
+```sh
+mkdir -p build
+sh seed/authority/store-cleanup-source.sh > build/store-cleanup.om
+cmp build/store-cleanup.om seed/authority/store-cleanup-gate.om
+seed/out/omc < build/store-cleanup.om > build/store-cleanup
+readelf -h build/store-cleanup
+chmod +x build/store-cleanup
+build/store-cleanup
+```
+
+Run each command only after its predecessor succeeds; never run failed compiler
+output. Expected: `store cleanup cases=18 fails=0`, exit 0. This standalone gate
+is not wired into `gate669`; existing real store, exact-store, dispatch,
+dispatch-order and full security gates remain separately required.
+
+Negative control: extract `seed/authority/store.om` from the publication base above,
+pass that path as the script's optional first argument, then compile/run the
+result identically. It must exit 1 without the success message: ten cases (five
+per writer) lack their required close. A compiler error, signal or timeout is
+INVALID, not a passing negative control. Both fixed and negative native outcomes
+are expectations, NOT observed results.
+
+## Inherited fixture corrections preserved
+
+The publication base already contains the #685/#686 identifier and global-array
+argument corrections. This candidate preserves those test files and the README
+fixture-correction notes byte-for-byte; it does not introduce or re-publish those
+repairs. They were reviewed alongside the new cleanup fixture during preparation.
+
+## Verification status
+
+- PASS: source diff whitespace check and shell syntax check.
+- PASS: source-only composer negative checks: separately changed the reviewed
+  fopen/write/fsync/fclose/renames argument prefix in temporary source copies;
+  all five returned nonzero with zero stdout. Missing source also returned
+  nonzero with zero stdout. No Omega source was compiled or executed.
+- PASS: independent source review of all three updated fixtures, scalar doubles,
+  effect traces, identifier limits, array arguments and negative-control structure.
+  This is source review, not compiler acceptance.
+- PASS: global/text names <=8 and function names <=63 across all authority
+  gate declarations; inherited global-array call replaced with a local copy.
+- PASS: all four existing affected gate concatenations match their component
+  sources exactly; new gate matches the source-composition script.
+- PASS: the pre-fix control composition differs only by the four missing cleanup
+  calls. No new production helper is needed by the old-source control.
+- PASS: pinned crumb structural compile/verify (source metadata only).
+- NOT_RUN: Omega compilation; fixed/negative execution; real syscall fd-leak
+  regression; full security gates; independent Linux AArch64/hardware replay.
+  No bundled native seed executable ran and no toolchain was installed.
+
+Keep draft. Source review and metadata checks are not functional qualification.
diff --git a/seed/authority/README.md b/seed/authority/README.md
index c453b8098..de6c0d5b9 100644
--- a/seed/authority/README.md
+++ b/seed/authority/README.md
@@ -44,11 +44,18 @@ Expected output and exit:
 | store | `store checks=077 000` | 0 |
 | dispatch | `dispatch checks=037 000` | 0 |
 | lock | `lock checks=8 fails=0` | 0 |
+| dispatch-order | `dispatch order checks=3 fails=0` | 0 |
+| store-exact | `store exact checks=4 fails=0` | 0 |
+| store-cleanup | `store cleanup cases=18 fails=0` | 0 |
 
 The authority gates and the standalone lock gate are run by
 `seed/qualification/security673/gate669.om` as part of the security qualification; the dispatcher
 also exercises the lock in its 37-check gate. A failure is a failed check count or a nonzero exit; a compile failure is
-`INVALID`, not a pass.
+`INVALID`, not a pass. The three newer regressions run after the existing authority gates,
+each with its own fresh child working directory beneath `build/security673-native`. Their
+relative `build/authority-store` fixtures cannot overwrite each other or the earlier gates.
+This filesystem separation is not a sandbox. See the coordinator README for retained artifacts
+and native verification limits.
 
 ## Cutover rule
 
@@ -78,8 +85,8 @@ build/dispatch-order-gate
 ```
 
 Run each command only after its predecessor succeeds; never execute failed compiler output.
-Expected: `dispatch order checks=3 fails=0`, exit 0. Build/run the existing dispatch gate and
-full security gate separately; this standalone regression is not yet wired into `gate669`.
+Expected: `dispatch order checks=3 fails=0`, exit 0. This regression is also wired into
+`gate669`; the existing dispatch and lock gates remain in that campaign.
 The negative control is the same compilation unit with only `dispatch.om` restored to the base
 revision's pre-acquisition read. It must exit 1 and print `FAIL dispatch acquired-record refusal`;
 the pre-acquisition read also fails the other two assertions (no release after a failed read,
@@ -123,10 +130,10 @@ Run each command only after its predecessor succeeds. Expected output is
 The test deliberately has no dependency on the new EOF-probe scratch buffer, so the old-source
 control remains a valid compilation unit. Failed compilation, signals and timeouts are INVALID.
 Run the existing store, dispatch, dispatcher-order and complete security gates as regressions.
-This standalone gate is not yet wired into `gate669`. Native run (2026-10-31, Linux AArch64,
+This gate is also wired into `gate669`. Native run (2026-10-31, Linux AArch64,
 seed/out/omc 7a8b84fc): positive `store exact checks=4 fails=0`, exit 0; negative controls with
 `store.om` from main 1db94162 and from a35697e9 each printed both `FAIL store trailing-...` lines,
-exit 1. Store (77), dispatch (37), dispatcher-order (3) and lock (5) gates pass on this revision.
+exit 1.
 
 `store-gate.om` has been regenerated as `store.om` followed by `store-test.om`. Its prior copy
 also lacked the already-existing `sgerr` generation-error interface; it now tests the current
@@ -158,3 +165,70 @@ scenarios or production sources. Declared concatenated gates are regenerated
 from this revision's own component sources. Source review is not compiler
 acceptance; the native runs are recorded in the section above.
 Historical evidence is unchanged.
+
+## Store write failure cleanup
+
+`writerec` and `writegen` close their opened descriptor once on failed/short
+write and failed fsync, preserving the primary errors (11/12 and 41/42) even
+if cleanup also fails. Close is never retried. Successful-path close errors
+remain 13/43, and record rename is skipped after any earlier error.
+
+`store-cleanup-test.om` provides 18 handwritten deterministic fake-effect cases.
+The committed `store-cleanup-gate.om` contains a test-only derivation of `store.om`
+followed by this test verbatim. It checks effect order, exactly-one close,
+descriptor identity and primary error precedence. It does not test real syscalls,
+fd ownership, durability or hardware. Production code has no test hooks.
+
+### Derivation and manual source-correspondence review
+
+New first-party runners/automation must be seeded `.om`. The temporary shell
+composer used during preparation is removed from active source; it was disposable
+authoring validation, not a supported runner. No replacement compiler or runner
+is introduced. Keep the handwritten test and committed `.om` gate reviewable.
+
+To derive the store prefix, preserve every line and scalar argument of `store.om`
+except these exact effect-call prefixes (ignore `note` comments):
+
+| Production prefix | Test-only prefix |
+| --- | --- |
+| `fopen spath` | `cfopen` |
+| `write int fd sb` | `cwrite int fd` |
+| `fsync int fd` | `cfsync int fd` |
+| `fclose int fd` | `cfclose int fd` |
+| `renames spkt` | `crenames` |
+
+The omitted global-buffer arguments cannot be passed to ordinary Omega functions;
+buffer contents are outside this test. Append `store-cleanup-test.om` unchanged.
+Before any approved compilation, manually compare the gate prefix against
+`store.om`: only the five substitutions above may differ. Compare its remaining
+suffix byte-for-byte against the test. Check that no executable `fopen`, `write`,
+`fsync`, `fclose` or `renames` token remains in the derived store prefix; reject
+any unrecognized call shape rather than leave a real write-side effect behind.
+The store read functions retain real `read` primitives but are never called by
+this fixture. The harness alone uses real stdout for its success message.
+
+For approved Linux AArch64 replay, compile the committed `store-cleanup-gate.om`
+with the existing reconstructed compiler, inspect the output, and execute only
+a successfully compiled artifact. Expected output: `store cleanup cases=18
+fails=0`, exit 0. For the negative control, apply the same reviewed derivation
+to `store.om` from `95529421e9a0e6d6d63ca5d8b8cdfaf443e0ef78`, followed by the
+current test unchanged. That prefix must differ only by four missing cleanup
+calls. Expected: exit 1 without the success message. Compilation failure,
+signal or timeout is INVALID, not a passing control.
+
+The historical preparation checks in
+[`store-write-cleanup/REVIEW.md`](../../evidence/SECURITY-673/store-write-cleanup/REVIEW.md)
+remain unchanged as evidence of checks observed then; its removed shell-helper
+commands are not current replay instructions. The manual derivation above and
+committed gate supersede those commands. Current source correspondence, absence
+of unmatched write-side effects, and metadata checks pass. This gate is wired
+into the existing security coordinator with its own fresh child working
+directory; the standalone replay and negative control remain available.
+
+Native run (2026-10-31, Linux AArch64, seed/out/omc 7a8b84fc after `sh seed/omega-from-seed.sh`
+reproduced it): the derivation above applied to this revision's `store.om` plus the test is
+byte-identical to the committed `store-cleanup-gate.om`; positive `store cleanup cases=18 fails=0`,
+exit 0. Negative control with the same derivation applied to `store.om` from 95529421 (differs only
+by the four missing `cleanup = cfclose int fd` lines): compiled, no output, exit 1 (the gate prints
+no per-case lines; exit 1 is its failed-case exit). Security qualification on hardware remains
+NOT_RUN.
diff --git a/seed/authority/dispatch-gate.om b/seed/authority/dispatch-gate.om
index a9a7acaed..aed32008c 100644
--- a/seed/authority/dispatch-gate.om
+++ b/seed/authority/dispatch-gate.om
@@ -241,9 +241,11 @@ ret 10
 end
 n = write int fd sb 0 256
 if ne n 256
+cleanup = fclose int fd
 ret 11
 end
 if ne fsync int fd 0
+cleanup = fclose int fd
 ret 12
 end
 if ne fclose int fd 0
@@ -314,9 +316,11 @@ put sb j uchar and shr v mul j 8 255
 end
 n = write int fd sb 0 8
 if ne n 8
+cleanup = fclose int fd
 ret 41
 end
 if ne fsync int fd 0
+cleanup = fclose int fd
 ret 42
 end
 if ne fclose int fd 0
diff --git a/seed/authority/dispatch-order-gate.om b/seed/authority/dispatch-order-gate.om
index 30ad6c40c..e03d99501 100644
--- a/seed/authority/dispatch-order-gate.om
+++ b/seed/authority/dispatch-order-gate.om
@@ -241,9 +241,11 @@ ret 10
 end
 n = write int fd sb 0 256
 if ne n 256
+cleanup = fclose int fd
 ret 11
 end
 if ne fsync int fd 0
+cleanup = fclose int fd
 ret 12
 end
 if ne fclose int fd 0
@@ -314,9 +316,11 @@ put sb j uchar and shr v mul j 8 255
 end
 n = write int fd sb 0 8
 if ne n 8
+cleanup = fclose int fd
 ret 41
 end
 if ne fsync int fd 0
+cleanup = fclose int fd
 ret 42
 end
 if ne fclose int fd 0
diff --git a/seed/authority/store-cleanup-gate.om b/seed/authority/store-cleanup-gate.om
new file mode 100644
index 000000000..0d30be5da
--- /dev/null
+++ b/seed/authority/store-cleanup-gate.om
@@ -0,0 +1,290 @@
+note SPDX-License-Identifier: AGPL-3.0-only
+note Durable 32-word authority record store. Caller supplies the record and generation.
+note Writes a temporary 256-byte file, fsyncs it, then atomically renames it into place.
+note Reads require exactly 256 bytes; a short or torn file is refused. Store calls do not lock; the
+note dispatcher holds lock.om around its read-check-persist window.
+text recp "build/authority-store/rec"
+text tmpp "build/authority-store/tmp"
+text genp "build/authority-store/gen"
+global sb uchar 256
+global stail uchar 1
+global spkt uchar 256
+global sn ulong 1
+global spath uchar 128
+global splen ulong 1
+global sgerr ulong 1
+fn put16 v ulong to void
+put spkt get sn 0 uchar and v 255
+put spkt add get sn 0 1 uchar shr v 8
+put sn 0 add get sn 0 2
+end
+fn setrec to void
+put splen 0 len recp
+for i ulong len recp
+put spath i get recp i
+end
+end
+fn settmp to void
+put splen 0 len tmpp
+for i ulong len tmpp
+put spath i get tmpp i
+end
+end
+fn setgen to void
+put splen 0 len genp
+for i ulong len genp
+put spath i get genp i
+end
+end
+fn pack2 to ulong
+put sn 0 0
+put16 2
+put16 len tmpp
+for i ulong len tmpp
+put spkt add get sn 0 i get tmpp i
+end
+put sn 0 add get sn 0 len tmpp
+put16 len recp
+for i ulong len recp
+put spkt add get sn 0 i get recp i
+end
+put sn 0 add get sn 0 len recp
+ret get sn 0
+end
+fn enc r view ulong 32 to void
+for i ulong 32
+v = get r i
+for j ulong 8
+put sb add mul i 8 j uchar and shr v mul j 8 255
+end
+end
+end
+fn dec r edit ulong 32 to ulong
+for i ulong 32
+v = ulong 0
+for j ulong 8
+v = or v shl ulong get sb add mul i 8 j mul j 8
+end
+put r i v
+end
+ret 0
+end
+fn writerec r view ulong 32 to ulong
+enc r
+settmp
+fd = cfopen 0 get splen 0 577 384
+if lt fd 0
+ret 10
+end
+n = cwrite int fd 0 256
+if ne n 256
+cleanup = cfclose int fd
+ret 11
+end
+if ne cfsync int fd 0
+cleanup = cfclose int fd
+ret 12
+end
+if ne cfclose int fd 0
+ret 13
+end
+pn = pack2
+rr = crenames 0 pn 0
+if lt rr 0
+ret 14
+end
+ret 0
+end
+fn readrec r edit ulong 32 to ulong
+setrec
+fd = cfopen 0 get splen 0 0 0
+if lt fd 0
+ret 20
+end
+n = read int fd sb 0 256
+extra = long -1
+if eq n 256
+extra = read int fd stail 0 1
+end
+if ne cfclose int fd 0
+ret 21
+end
+if or ne n 256 ne extra 0
+ret 22
+end
+dv = dec r
+ret 0
+end
+fn readgen to ulong
+put sgerr 0 0
+setgen
+fd = cfopen 0 get splen 0 0 0
+if lt fd 0
+put sgerr 0 30
+ret 0
+end
+n = read int fd sb 0 8
+extra = long -1
+if eq n 8
+extra = read int fd stail 0 1
+end
+if ne cfclose int fd 0
+put sgerr 0 31
+ret 0
+end
+if or ne n 8 ne extra 0
+put sgerr 0 32
+ret 0
+end
+v = ulong 0
+for j ulong 8
+v = or v shl ulong get sb j mul j 8
+end
+ret v
+end
+fn writegen v ulong to ulong
+setgen
+fd = cfopen 0 get splen 0 577 384
+if lt fd 0
+ret 40
+end
+for j ulong 8
+put sb j uchar and shr v mul j 8 255
+end
+n = cwrite int fd 0 8
+if ne n 8
+cleanup = cfclose int fd
+ret 41
+end
+if ne cfsync int fd 0
+cleanup = cfclose int fd
+ret 42
+end
+if ne cfclose int fd 0
+ret 43
+end
+ret 0
+end
+fn storevalid r view ulong 32 g ulong to ulong
+if ne get r 0 1
+ret 51
+end
+if ne get r 4 g
+ret 52
+end
+ret 0
+end
+note SPDX-License-Identifier: AGPL-3.0-only
+note Handwritten deterministic effect doubles, not a real fd/syscall/durability test.
+note Committed gate derivation and manual correspondence checks are in README.md.
+note Only the store's five write-side effects are doubled; no shipped shell composer.
+note Modes: open error, write error, short write, sync error, close error, success,
+note write plus close error, sync plus close error, rename error. Both writers run all modes.
+global cmode ulong 1
+global ctrace ulong 1
+global cbad ulong 1
+global cfails ulong 1
+text cleanok "store cleanup cases=18 fails=0\n"
+fn cstep step ulong to void
+put ctrace 0 add mul get ctrace 0 10 step
+end
+fn cfd fd int to void
+if ne fd 7
+put cbad 0 1
+end
+end
+fn cfopen off ulong count ulong flags ulong mode ulong to long
+cstep 1
+if eq get cmode 0 0
+ret -1
+end
+ret 7
+end
+fn cwrite fd int off ulong count ulong to long
+cfd fd
+cstep 2
+if or eq get cmode 0 1 eq get cmode 0 6
+ret -1
+end
+if eq get cmode 0 2
+ret long sub count 1
+end
+ret long count
+end
+fn cfsync fd int to long
+cfd fd
+cstep 3
+if or eq get cmode 0 3 eq get cmode 0 7
+ret -1
+end
+ret 0
+end
+fn cfclose fd int to long
+cfd fd
+cstep 4
+if or eq get cmode 0 4 or eq get cmode 0 6 eq get cmode 0 7
+ret -1
+end
+ret 0
+end
+fn crenames off ulong count ulong flags ulong to long
+cstep 5
+if eq get cmode 0 8
+ret -1
+end
+ret 0
+end
+fn cbadcase result ulong want ulong trace ulong to bool
+ret or ne result want or ne get ctrace 0 trace ne get cbad 0 0
+end
+fn main to int
+r = new ulong 32 0
+for writer ulong 2
+for mode ulong 9
+put cmode 0 mode
+put ctrace 0 0
+put cbad 0 0
+result = ulong 0
+base = ulong 10
+trace = ulong 12345
+if eq writer 0
+result = writerec r
+else
+base = 40
+trace = 1234
+result = writegen 1
+end
+want = ulong 0
+if eq mode 0
+want = base
+trace = 1
+end
+if or eq mode 1 or eq mode 2 eq mode 6
+want = add base 1
+trace = 124
+end
+if or eq mode 3 eq mode 7
+want = add base 2
+trace = 1234
+end
+if eq mode 4
+want = add base 3
+trace = 1234
+end
+if and eq mode 8 eq writer 0
+want = 14
+end
+if cbadcase result want trace
+put cfails 0 add get cfails 0 1
+end
+end
+end
+if ne get cfails 0 0
+ret 1
+end
+w = write 1 cleanok 0 len cleanok
+if ne w long len cleanok
+ret 2
+end
+ret 0
+end
diff --git a/seed/authority/store-cleanup-test.om b/seed/authority/store-cleanup-test.om
new file mode 100644
index 000000000..23c95252d
--- /dev/null
+++ b/seed/authority/store-cleanup-test.om
@@ -0,0 +1,114 @@
+note SPDX-License-Identifier: AGPL-3.0-only
+note Handwritten deterministic effect doubles, not a real fd/syscall/durability test.
+note Committed gate derivation and manual correspondence checks are in README.md.
+note Only the store's five write-side effects are doubled; no shipped shell composer.
+note Modes: open error, write error, short write, sync error, close error, success,
+note write plus close error, sync plus close error, rename error. Both writers run all modes.
+global cmode ulong 1
+global ctrace ulong 1
+global cbad ulong 1
+global cfails ulong 1
+text cleanok "store cleanup cases=18 fails=0\n"
+fn cstep step ulong to void
+put ctrace 0 add mul get ctrace 0 10 step
+end
+fn cfd fd int to void
+if ne fd 7
+put cbad 0 1
+end
+end
+fn cfopen off ulong count ulong flags ulong mode ulong to long
+cstep 1
+if eq get cmode 0 0
+ret -1
+end
+ret 7
+end
+fn cwrite fd int off ulong count ulong to long
+cfd fd
+cstep 2
+if or eq get cmode 0 1 eq get cmode 0 6
+ret -1
+end
+if eq get cmode 0 2
+ret long sub count 1
+end
+ret long count
+end
+fn cfsync fd int to long
+cfd fd
+cstep 3
+if or eq get cmode 0 3 eq get cmode 0 7
+ret -1
+end
+ret 0
+end
+fn cfclose fd int to long
+cfd fd
+cstep 4
+if or eq get cmode 0 4 or eq get cmode 0 6 eq get cmode 0 7
+ret -1
+end
+ret 0
+end
+fn crenames off ulong count ulong flags ulong to long
+cstep 5
+if eq get cmode 0 8
+ret -1
+end
+ret 0
+end
+fn cbadcase result ulong want ulong trace ulong to bool
+ret or ne result want or ne get ctrace 0 trace ne get cbad 0 0
+end
+fn main to int
+r = new ulong 32 0
+for writer ulong 2
+for mode ulong 9
+put cmode 0 mode
+put ctrace 0 0
+put cbad 0 0
+result = ulong 0
+base = ulong 10
+trace = ulong 12345
+if eq writer 0
+result = writerec r
+else
+base = 40
+trace = 1234
+result = writegen 1
+end
+want = ulong 0
+if eq mode 0
+want = base
+trace = 1
+end
+if or eq mode 1 or eq mode 2 eq mode 6
+want = add base 1
+trace = 124
+end
+if or eq mode 3 eq mode 7
+want = add base 2
+trace = 1234
+end
+if eq mode 4
+want = add base 3
+trace = 1234
+end
+if and eq mode 8 eq writer 0
+want = 14
+end
+if cbadcase result want trace
+put cfails 0 add get cfails 0 1
+end
+end
+end
+if ne get cfails 0 0
+ret 1
+end
+w = write 1 cleanok 0 len cleanok
+if ne w long len cleanok
+ret 2
+end
+ret 0
+end
diff --git a/seed/authority/store-exact-gate.om b/seed/authority/store-exact-gate.om
index a94ef12c8..57a56def7 100644
--- a/seed/authority/store-exact-gate.om
+++ b/seed/authority/store-exact-gate.om
@@ -78,9 +78,11 @@ ret 10
 end
 n = write int fd sb 0 256
 if ne n 256
+cleanup = fclose int fd
 ret 11
 end
 if ne fsync int fd 0
+cleanup = fclose int fd
 ret 12
 end
 if ne fclose int fd 0
@@ -151,9 +153,11 @@ put sb j uchar and shr v mul j 8 255
 end
 n = write int fd sb 0 8
 if ne n 8
+cleanup = fclose int fd
 ret 41
 end
 if ne fsync int fd 0
+cleanup = fclose int fd
 ret 42
 end
 if ne fclose int fd 0
diff --git a/seed/authority/store-gate.om b/seed/authority/store-gate.om
index 30700b427..10faad6d7 100644
--- a/seed/authority/store-gate.om
+++ b/seed/authority/store-gate.om
@@ -78,9 +78,11 @@ ret 10
 end
 n = write int fd sb 0 256
 if ne n 256
+cleanup = fclose int fd
 ret 11
 end
 if ne fsync int fd 0
+cleanup = fclose int fd
 ret 12
 end
 if ne fclose int fd 0
@@ -151,9 +153,11 @@ put sb j uchar and shr v mul j 8 255
 end
 n = write int fd sb 0 8
 if ne n 8
+cleanup = fclose int fd
 ret 41
 end
 if ne fsync int fd 0
+cleanup = fclose int fd
 ret 42
 end
 if ne fclose int fd 0
diff --git a/seed/authority/store.om b/seed/authority/store.om
index c924cc389..0691e8484 100644
--- a/seed/authority/store.om
+++ b/seed/authority/store.om
@@ -78,9 +78,11 @@ ret 10
 end
 n = write int fd sb 0 256
 if ne n 256
+cleanup = fclose int fd
 ret 11
 end
 if ne fsync int fd 0
+cleanup = fclose int fd
 ret 12
 end
 if ne fclose int fd 0
@@ -151,9 +153,11 @@ put sb j uchar and shr v mul j 8 255
 end
 n = write int fd sb 0 8
 if ne n 8
+cleanup = fclose int fd
 ret 41
 end
 if ne fsync int fd 0
+cleanup = fclose int fd
 ret 42
 end
 if ne fclose int fd 0
diff --git a/seed/qualification/security673/.crumb b/seed/qualification/security673/.crumb
index eb04e18a9..297910502 100644
--- a/seed/qualification/security673/.crumb
+++ b/seed/qualification/security673/.crumb
@@ -10,14 +10,14 @@
         }
       ],
       "children_root": "sha256:f41d6df2f8ad3022a730e903b841378e27265d8aa2553318ec209b4ede234b2b",
-      "compiled_at": "2026-10-31T03:22:28Z",
+      "compiled_at": "2026-10-31T05:08:48Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:f61b83bd16e26c180bf91e66e9c28095085f3a0756c3fead4a87e09ac3e90b22",
+      "digest": "sha256:188d734278c7ba4917a7e096656791d7db45c293f73fab029f1b39d0f07c7206",
       "evidence_files": 1320,
       "evidence_root": "sha256:10232d8c64af6b0c77b53ca0d23ccc3a14bcad54b28430e469615b93567f1f96",
       "files": 1432,
-      "generated_at_commit": "d3763c7f271e123765c88cbbf837030a1ac95c94",
-      "source_tree": "sha256:c6c007e80b7b468f58b91d6fcb1b0c4c8f9d10671d2f0d058a2da79ef0eb0831"
+      "generated_at_commit": "e1653b2d0b3c5134d573b923f09f9d907b59600e",
+      "source_tree": "sha256:558d7a09e126dd9b5900a492439f439d9f5ab3ccdd2f8a5c9ff84b689b5ec334"
     }
   },
   "name": "security673",
diff --git a/seed/qualification/security673/README.md b/seed/qualification/security673/README.md
index a0e8c3538..d55d31f3e 100644
--- a/seed/qualification/security673/README.md
+++ b/seed/qualification/security673/README.md
@@ -130,3 +130,48 @@ buffer returns -105 without changing the slice; an invalid index traps 3; and an
 read returns the length. Evidence is `evidence/SECURITY-673/paths1`. Path traversal is not confined
 by `fopen`; the strict launch profile is the confined path. Legacy manifest, receipt, RPC, model,
 trace and device parsers remain NOT_RUN.
+
+
+## Authority regression integration (source-reviewed, host-run)
+
+The existing `authority` campaign now includes `dispatch-order-gate.om`,
+`store-exact-gate.om` and `store-cleanup-gate.om` after the existing action,
+delegation, reuse, store, dispatch, SHA256 and lock gates. These are the same
+committed compilation units documented in `seed/authority/README.md`; the
+coordinator neither recomposes them nor changes their production components.
+The expected exits are all 0, with the following child stdout:
+
+- `dispatch order checks=3 fails=0`
+- `store exact checks=4 fails=0`
+- `store cleanup cases=18 fails=0`
+
+Each new gate is compiled through the existing `compile` path using the twice
+rebuilt compiler. Before running it, the coordinator creates a fresh numbered
+mode-0700 directory under its already-fresh `build/security673-native` directory.
+An existing directory or any mkdir error fails closed. Only the forked child
+changes into it, after opening stdin/stdout/stderr from the repository-root
+parent. Consequently each test's relative `build/authority-store` is private to
+that test, including the malformed files deliberately retained by store-exact.
+The parent, other gates and compiler invocations keep their original cwd.
+Existing authority gates keep their existing fixture paths; this change does
+not isolate or redesign those gates.
+
+The executable argument is an absolute path formed from checked `cwd` output
+and the exact numbered compiler artifact before the child changes directory.
+Path and argument-packet capacity failures refuse the run. Child `chdir` failure
+exits 97 before `execprog`; failed exec exits 98. The existing expected-exit,
+signal and deadline checks reject both, and no later PASS is reached. The log
+records the absolute executable, input/output/error artifacts and `cwd=` path.
+The filesystem separation is for fixture/evidence retention, not confinement or
+protection against a hostile actor replacing trusted checkout files. The three
+new tests do not intentionally launch an effect child on their expected paths.
+Their negative controls remain separate replay procedures, not coordinator runs.
+
+Source composition, path construction, identifier limits and fail-closed control
+flow were first checked without executing Omega binaries. Native run (2026-10-31,
+Linux AArch64, seed/out/omc 7a8b84fc): the full coordinator `gate669.om` exits 0
+with `GATE669 PASS`; the dispatch-order, store-exact and store-cleanup steps each
+log `exit=0 expected=0` for compile and run in their own `cwd=` directories. The
+three negative controls were replayed separately (see `seed/authority/README.md`)
+and each exits 1. This is host execution, not hardware qualification. Existing
+L408 compiler integration and Renda review ownership are unchanged.
diff --git a/seed/qualification/security673/gate669.om b/seed/qualification/security673/gate669.om
index 40ae22e09..6172d3d70 100644
--- a/seed/qualification/security673/gate669.om
+++ b/seed/qualification/security673/gate669.om
@@ -4,10 +4,11 @@ note GNU objdump is an independent decoder. Hashes identify artifacts and do not
 text bd "build"
 text scratch "build/security673-native"
 text prefix "build/security673-native/"
-text names "seed/omc/omc.om\nseed/qualification/security673/branch-corpus.om\nseed/qualification/security673/branch-mutate.om\nseed/qualification/security673/branch-check.om\n/usr/bin/objdump\n-D\n-b\nbinary\n-m\naarch64\n0\n1\n/dev/null\nseed/rung4/om4.bin\nseed/qualification/security673/array-fill.om\nseed/qualification/security673/oracle-corpus.om\nseed/qualification/security673/gate-child.om\nseed/qualification/security673/hostile-corpus.om\n3\nseed/qualification/security673/branch-forms.om\nseed/qualification/security673/packet-corpus.om\nseed/qualification/security673/pkt-consumer.om\nseed/qualification/security673/renames-corpus.om\nseed/qualification/security673/renames-consumer.om\nseed/qualification/security673/path-consumer.om\nseed/authority/action-gate.om\nseed/authority/delegate-gate.om\nseed/authority/reuse-gate.om\nseed/authority/store-gate.om\nseed/authority/dispatch-gate.om\nseed/trace/sha256-gate.om\nseed/authority/lock-gate.om\n"
+text names "seed/omc/omc.om\nseed/qualification/security673/branch-corpus.om\nseed/qualification/security673/branch-mutate.om\nseed/qualification/security673/branch-check.om\n/usr/bin/objdump\n-D\n-b\nbinary\n-m\naarch64\n0\n1\n/dev/null\nseed/rung4/om4.bin\nseed/qualification/security673/array-fill.om\nseed/qualification/security673/oracle-corpus.om\nseed/qualification/security673/gate-child.om\nseed/qualification/security673/hostile-corpus.om\n3\nseed/qualification/security673/branch-forms.om\nseed/qualification/security673/packet-corpus.om\nseed/qualification/security673/pkt-consumer.om\nseed/qualification/security673/renames-corpus.om\nseed/qualification/security673/renames-consumer.om\nseed/qualification/security673/path-consumer.om\nseed/authority/action-gate.om\nseed/authority/delegate-gate.om\nseed/authority/reuse-gate.om\nseed/authority/store-gate.om\nseed/authority/dispatch-gate.om\nseed/trace/sha256-gate.om\nseed/authority/lock-gate.om\nseed/authority/dispatch-order-gate.om\nseed/authority/store-exact-gate.om\nseed/authority/store-cleanup-gate.om\n"
 text input " < "
 text output " > "
 text errors " 2> "
+text cwdmsg " cwd="
 text nl "\n"
 text statusm "exit="
 text expect " expected="
@@ -21,6 +22,7 @@ text failed "GATE669 FAIL; retain all scratch files and command output\n"
 global pathbuf uchar 4096
 global plen ulong 1
 global serial ulong 1
+global workdir ulong 1
 global argv uchar 4096
 global argc ulong 1
 global apos ulong 1
@@ -106,8 +108,7 @@ end
 put serial 0 n
 ret add 1000 n
 end
-fn arg id ulong to void
-setpath id
+fn packarg to void
 p = get apos 0
 n = get plen 0
 if gt add add p n 2 len argv
@@ -122,6 +123,46 @@ end
 put apos 0 add p n
 put argc 0 add get argc 0 1
 end
+fn arg id ulong to void
+setpath id
+packarg
+end
+note Shift the relative path right by base+1 (from its end), then prefix the cwd and '/'.
+fn absjoin base ulong size ulong to void
+for i ulong get plen 0
+at = sub sub get plen 0 i 1
+put pathbuf add add base 1 at get pathbuf at
+end
+for i ulong base
+put pathbuf i get other i
+end
+put pathbuf base 47
+put plen 0 size
+end
+note Isolated children use the absolute executable path captured before chdir.
+fn abscmd exe ulong to void
+setpath exe
+n = cwd other 0 len other
+if or le n 1 gt n long len other
+stop
+end
+base = sub ulong n 1
+if or ne get other 0 47 ne get other base 0
+stop
+end
+size = add add base 1 get plen 0
+if gt size len pathbuf
+stop
+end
+absjoin base size
+put argc 0 0
+put apos 0 2
+packarg
+r = write 1 pathbuf 0 size
+if ne r long size
+stop
+end
+end
 fn command exe ulong to void
 put argc 0 0
 put apos 0 2
@@ -192,6 +233,10 @@ r = write 1 output 0 len output
 showpath outid
 r = write 1 errors 0 len errors
 showpath errid
+if ne get workdir 0 0
+r = write 1 cwdmsg 0 len cwdmsg
+showpath get workdir 0
+end
 r = write 1 nl 0 1
 rd = openfile source 524288
 wr = openfile outid 524481
@@ -206,6 +251,12 @@ if eq pid 0
 redirect rd 0
 redirect wr 1
 redirect er 2
+if ne get workdir 0 0
+setpath get workdir 0
+if ne chdir pathbuf 0 get plen 0 0
+exit 97
+end
+end
 r = execprog argv 0 get apos 0
 exit 98
 end
@@ -543,6 +594,19 @@ elf = compile cc id 0
 command elf
 outid = run 13 0
 end
+note Only these three regressions get fresh child cwd; parent stays at repository root.
+fn authiso cc ulong id ulong to void
+elf = compile cc id 0
+dir = fresh
+setpath dir
+if ne makedir pathbuf 0 get plen 0 448 0
+stop
+end
+abscmd elf
+put workdir 0 dir
+outid = run 13 0
+put workdir 0 0
+end
 fn authority cc ulong to void
 authone cc 26
 authone cc 27
@@ -551,6 +615,9 @@ authone cc 29
 authone cc 30
 authone cc 31
 authone cc 32
+authiso cc 33
+authiso cc 34
+authiso cc 35
 end
 fn main to int
 if or lt argcnt 1 gt argcnt 2