Skip to content

#267: the differential harness gates only the attested musl artifact of its commit; --dev is labelled - #273

Merged
SSFSKIM merged 6 commits into
mainfrom
fix/267-attested-candidate
Nov 2, 2026
Merged

SSFSKIM merged 6 commits into
mainfrom
fix/267-attested-candidate

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Closes #267

A verdict run of the Linux differential harness is now a release gate by default. For a gate, the harness takes as cua's candidate only the release workflow's attested static musl artifact of the commit the checkout is at, with the checkout clean. --dev runs any build, and its verdict, its summary.md and its stdout say development run, not a release gate. The engine is unchanged (git diff origin/main -- native/ is empty).

Interface: --cua <file> still names the candidate, and --dev is the only way out of the gate. The harness stores the file as cua-engine, mode 0700, in a directory of its own (a downloaded artifact loses its executable bit). Every check reads that copy, and every cua lane runs it. The copy is removed on a refusal, an error, the run's end, or a stop at any point. A stop handler is installed from before the copy is made until the run's own (the Desktop's) takes over, so there is no gap. A stop during the checks kills the command in flight with SIGKILL and waits for it to end before the harness exits 143 (or 130). A gate runs the candidate (--version) only once it is attested. A --run name the out directory already has rows for is refused (run refused, exit 2), and summary.md does not judge a name whose rows mix a gate and a dev run.

A gate refuses each of the following with its reason, as candidate refused: … and exit 2, before anything runs:

  • a non-ELF file, or a gnu, dynamic or foreign-architecture build;
  • a checkout that is not clean;
  • an unattested file (gh attestation verify … --signer-workflow SSFSKIM/cua/.github/workflows/linux-engine.yml --deny-self-hosted-runners --format json);
  • a digest mismatch;
  • a commit mismatch;
  • a --version naming another commit.

The run records the candidate in its meta row: sha256, target, linkage, version, commit, clean, and each verified attestation (subjects, source commit and ref, workflow run, runner), all read from gh's JSON. The end row records gate. The README section "The candidate" documents all of this.

Validation Evidence

  • Review fixes are covered by failing-first tests. Round 1 added five tests to candidate.test.mjs; against 32a2e29 they gave pass 13, fail 5. They check that:

    • a refused gate candidate never runs (a shell script that would create a marker file is refused as not ELF, and no marker appears);
    • none of six refusal kinds invokes the candidate, and an accepted gate calls gh before --version;
    • the reviewer's probe (an unfinished gate, then a dev retry that passed under the same name) is not judged;
    • a reused run name is refused;
    • a run sent SIGTERM while its --version blocks exits 143 with no copy left.

    Round 2 added two more; against 23c2709 they gave pass 18, fail 2. They check that:

    • a SIGTERM delivered as the run begins, before its own handler is in place, is handled (exit 143, no copy). With the gap reintroduced, the run dies by SIGTERM.
    • a SIGTERM during the checks ends a --version command that ignores SIGTERM before the harness exits 143. Its pid is gone, and no copy is left.

    Now node --test test/linux-engine-diff/candidate.test.mjs gives pass 20, fail 0.

  • The failing-first tests named in the issue pass. node --test test/linux-engine-diff/candidate.test.mjs reported pass 13, fail 0. Before the implementation, the same tests run against a stub that behaves like the old harness (it accepts anything and records nothing) reported pass 0, fail 13. The tests cover:

    • a gnu ELF refused, both dynamic and static glibc;
    • an unattested file refused;
    • a digest mismatch refused;
    • a commit mismatch refused;
    • a dev verdict labelled.

    They also cover a non-ELF file, a foreign architecture, a --version naming another commit, a dirty checkout, no copy left after a refusal, an accepted gate's cua-engine 0700 copy and full record, a dev run making no gh call, and --dev refused by experiments.

  • The whole harness suite passes. node --test test/linux-engine-diff/*.test.mjs reported tests 322, pass 322, fail 0 on a5f86ee.

  • The gate accepts the real attested 0.3.0 artifact at its commit. The asset came from gh release download linux-engine-v0.3.0 --repo SSFSKIM/cua -p cua-engine-0.3.0-linux-x64 into a fresh empty directory; it arrived with mode 600 and sha256 5f4a1600…7b60. I ran the committed candidate.mjs in gate mode, with the worktree checked out clean at detached cd4c929, using real git and real gh. Output: accepted: stored as cua-engine, mode 700, x86_64-unknown-linux-musl static-pie, cua-engine 0.3.0 (cd4c929758ca). gh returned two verified attestations, both built from cd4c929 on GitHub-hosted runners: run 41364541329 (release/linux-engine-v0.3.0) and run 41350086196 (feat/171-m3).

  • The CLI refuses live, from this branch at 32a2e29 with a clean checkout. Each case exited 2, created no out directory and left no copy:

    • The 0.3.0 asset: candidate refused: commit mismatch: the candidate was built from cd4c929758caf90329fd5cfb0d5028f1ec1c92c2, and the checkout is at 32a2e2963e5817bf0196537c706a3029e588fddf. This case got past gh's verification and the digest check.
    • The VM's gnu build from M3 task 25: candidate refused: the candidate is built for x86_64-unknown-linux-gnu (dynamic, interpreter /lib64/ld-linux-x86-64.so.2): the release ships the workflow's x86_64-unknown-linux-musl static-pie.
    • The asset with one byte appended: candidate refused: unattested: gh found no attestation of .github/workflows/linux-engine.yml … (Error: HTTP 404: Not Found …).
  • A short live dev verdict run works and is labelled. On the downloaded asset, scene desktop, op list_windows, 1 block, the output was:

    development run, not a release gate; candidate: sha256 5f4a1600…, x86_64-unknown-linux-musl static-pie, cua-engine 0.3.0 (cd4c929758ca); attestation not checked (a development run)
    run valid; development run, not a release gate: every verdict PASS
    

    It exited 0, and the summary heading reads ## t28-dev (development run, not a release gate). The window list on :0 was identical before and after, and no copy was left.

  • A stopped run cleans up.

    • On 32a2e29, I sent SIGINT to a dev run 3 s in. It exited 130, left no candidate copy, and the windows on :0 were unchanged.
    • On 23c2709, a gate sent SIGTERM 300 ms in, during its checks, exited 143 with no copy left. Its log line "gh or engine processes left: 3" was a name match that caught another session's harness run (t3-truncation-dev, pid 598042 and its two engines), not processes this run started. The log now says so.
    • Round 2's stop-handler and SIGKILL fixes are proven hermetically, by the tests above. No live run was made on :0, which another task owns.
  • CI is green. ci-gate --gates engine-linux,test on a5f86ee: PASS engine-linux 3m34s, PASS test 8m02s, GREEN https://github.com/SSFSKIM/cua/actions/runs/41380898798. It was also GREEN on 32a2e29 (run 41376623039) and on 23c2709 (run 41379130368).

Residue

  • No full gate-mode verdict run was accepted live with this harness. The gate requires HEAD to be the attestation's source commit. This branch's harness isn't at cd4c929, and the workflow won't build another 0.3.0 because the tag exists. The acceptance path is proven live at the candidate step (above). M4's gate, on its own build-only artifact, will be the first full accepted gate run.
  • On the VM, a musl build made the workflow's way is not the attested bytes. I built cd4c929 the workflow's way: rustc 1.94.1, hermetic CARGO_HOME, the path remaps, CUA_ENGINE_GIT_SHA, and the same strip. It produced 15cee88b… (4 KB smaller), and the gate refused it as unattested. In practice, then, a gate takes the workflow's artifact. The README says so. I didn't look into the cause.
  • The experiments, including the drag cells M4 plans to add to the gate sitting, still take --cua raw. When they join the gate, they should take the candidate through prepareCandidate too.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)

…f its commit, or --dev

The differential harness stores cua's candidate itself (cua-engine, mode 0700) and, for a gate,
refuses a gnu, dynamic or foreign-architecture build, a checkout not clean, an unattested file,
a digest mismatch, a commit mismatch and a --version naming another commit, each with its reason,
before anything runs. The run records the candidate's sha256, target, version and what
gh attestation verify --format json verified; --dev runs any build and its verdict, summary
and stdout say it is not a release gate.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…ay musl build is not the attested bytes

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
… nothing can start it

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…ing the checks leaves no copy; one execution per run name

- A gate checks the file, the checkout and the attestation before it runs the candidate (--version last); a dev run
  runs it unchecked.
- runDiff owns the copy's directory from before the copy and handles a stop (SIGINT/SIGTERM) during the checks:
  the copy is removed and the command in flight killed. The checks run their commands without blocking the event
  loop, so the stop is handled at once.
- A run name the out directory already has rows of is refused (run refused, exit 2); summary.md does not judge a
  name whose rows mix a gate and a dev run, and the verdict line takes its label from the end row itself.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
… a stop during the checks kills and reaps the command

- runDiff's stop handler stays installed until the Desktop's is in place (diffRun calls handoff right after
  constructing it), so a stop is never the default action that skips the copy's removal at the exit.
- A stop during the checks kills the command in flight with SIGKILL (one that ignores SIGTERM included) and
  waits for it to end before the harness exits; the checks then reject with PreparationStopped, never an
  ordinary command result, and start no further command.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
SSFSKIM added a commit that referenced this pull request Nov 2, 2026
…he VM musl build is not the artifact; the literal commit rule)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
@SSFSKIM
SSFSKIM merged commit fc091b8 into main Nov 2, 2026
4 checks passed
SSFSKIM added a commit that referenced this pull request Nov 2, 2026
…t means a rebuild (the design session, #273 merged)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
SSFSKIM added a commit that referenced this pull request Nov 2, 2026
main brings T1 (#267, PR #273): a verdict run is a release gate unless --dev
is given; candidate.mjs checks and stores the candidate; run.mjs splits into
runDiff (the run name's uniqueness, the candidate's preparation, the stop
handler until the run's own) and diffRun (the run proper, labelled by the
candidate's gate). feat/171-m4 brings T2's application stderr logs (the
Desktop's `logs`) and T3's truncation field (normalize.mjs, deviations.mjs,
services.mjs, and run.mjs's declared-field handling).

One conflict, scripts/linux-engine-diff/run.mjs, at the Desktop's creation
in diffRun: main added `handoff()` straight after it, and this branch added
`logs: args.out` to its arguments. Both kept: the Desktop takes the
run's out directory for the application logs, and the checks' stop handler
hands over to the Desktop's as soon as it exists, with no moment between.
Every other hunk of run.mjs merged cleanly: T3's truncation handling sits in
the sample loop, which main did not touch, and main's candidate preparation
sits above it.

Checked: node --test test/linux-engine-diff/*.test.mjs 332/332; cargo test
--release --locked (native/linux-engine) 205 passed, 32 ignored.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux differential harness: take the release workflow's attested artifact, refuse a gnu candidate

1 participant