Add canonical CMUX workload profiles

Merged
TE
2mo ago
+3484-196

CMUX repeatedly asks CI, developer machines, and fleet workers to perform the same meaningful operations, but those operations currently have no stable repository-owned identity. That makes machine acceptance, cache experiments, Glaeda routing, and performance comparisons vulnerable to command drift.

This adds a first-generation workload registry and semantic runner owned by CMUX.

Result

The first four profiles are:

  • cmux.macos.compile-admission@1
  • cmux.macos.dev-check@1
  • cmux.macos.app-host-test-shard@1
  • cmux.ci.guard@1

Each profile binds an explicit semantic generation, repository entrypoint, platform requirements, result/artifact class, timeout/resource/network class, and admitted benchmark-state classes. Internal refactors can preserve a generation when the operation and validity contract stay equivalent; semantic changes require a generation bump.

The runner freezes the exact CMUX commit/tree, validates profile generation and bounded parameters, invokes only checked-in CMUX entrypoints, records stage timings/toolchain/resources/artifact identities/process settlement, and emits cmux-workload-result/v1 with passed|failed|timed_out|ambiguous.

Benchmark comparison keys bind exact source tree, profile/generation, semantic validator, reviewed environment class, semantic parameters, exact runtime-input identities, state class, and toolchain. compare refuses mismatched semantics/context, failed results, incomplete artifact validation, or incomplete cleanup.

The existing workflow-guard-tests job now runs cmux.ci.guard@1 through this runner and prints the semantic receipt, giving the first hosted execution path.

Existing front doors

This adds no second build implementation:

  • compile admission delegates to scripts/ci/compile-app-host-test-product.sh plus the existing Xcode/Rust/warning-budget helpers;
  • developer checking delegates to the canonical tagged reload.sh build with a profile-owned unique tag, private DerivedData/SourcePackages, no launch, no global CLI links, local backend mode, and cloud dogfood disabled;
  • app-host shards use cmux_unit_test_shard.py, run-in-console-session.sh, and run-app-host-xcodebuild.sh;
  • CI guard calls the existing routing/runner/required-check/shard/test-wiring guards.

docs/workload-profiles.md defines the CMUX/Glaeda ownership boundary and initial fleet-role mapping.

Validation

  • the repository workload-profile contract suite covers registry/semantic identity, closed environments, result publication, source/submodule integrity, checkout mutation leasing, runtime-input hashing/drift, bounded shard parameters, and benchmark comparison;
  • shell entrypoints pass bash -n;
  • hosted cmux.ci.guard@1 execution is wired into workflow-guard-tests on this branch.

Physical Mac execution remains a later fleet proof on an explicitly eligible node.

Related: #13095, #6134, #13198, #13091, #13325.
Glaeda: teamleaderleo/glaeda#148, #546, #547, #1056, #1057, #743.


Summary by cubic

Adds a repository-owned CMUX workload profile registry and semantic runner so CI, developer machines, and fleet workers share one stable operation identity instead of drifting commands. Four generation-1 profiles land (cmux.macos.compile-admission, cmux.macos.dev-check, cmux.macos.app-host-test-shard, cmux.ci.guard); the registry and runner work independently of fleet activation, with only hosted CI execution wired in on this branch.

Runner contract

  • run freezes the exact commit/tree under an exclusive checkout lease, rejects dirty materialized submodules, serializes shared checkout build mutations, validates generation and declared environment/inputs, closes execution to undeclared classes, and revalidates source and runtime inputs after execution.
  • Receipts record timings, toolchain, resources, and artifacts and emit passed, failed, timed_out, or ambiguous; process groups settle before children are reaped, a leaked child forces ambiguous even on zero exit, and results publish inside the private state root.
  • compare recomputes result keys, verifies toolchain identity, and refuses mismatched semantics, failed results, incomplete artifact validation, or incomplete cleanup.

Wiring, docs, and fleet

  • Toolchain selection exports only DEVELOPER_DIR without touching the host-global Xcode default; dev-check uses the canonical tagged reload validated through the shared mobile-attach helper, the app-host shard fails closed on shard-planning errors and empty filters, and compile admission materializes the checksum-pinned GhosttyKit framework.
  • workflow-guard-tests now runs as a grouped matrix; cmux.ci.guard@1 executes in it and prints the semantic receipt, with the workload-profile contract suite assigned to the ci group; change-area routing follows indirect guard-profile references and projects the guard-owned tests/ paths onto every invoking job.
  • Persistent-Mac compile routing now allocates the required hosted job without waiting for the producer, restoring any exact reusable product first and consuming the persistent artifact only when --ready-only observation confirms the compile is complete, otherwise falling back to hosted compile.
  • docs/workload-profiles.md, docs/fleet-enrollment.md, and docs/ci-runners.md document the registry, result contract, and enrollment; Glaeda #1091 adds the repaired accept-local boundary for local execution, post-run re-observation, and candidate eligibility, while physical Mac execution stays gated on explicit canary authorization.

Summary by CodeRabbit

  • New Features

    • Added workload profiles for macOS builds, development checks, app-host test shards, and Linux CI guards.
    • Added commands to validate, inspect, plan, run, compare, and stage profiles.
    • Added isolated execution, timeout handling, artifact collection, result validation, and cleanup reporting.
    • Added automated CI validation and execution for the canonical guard profile.
  • Bug Fixes

    • Improved detection of tests referenced indirectly through workload profiles.
    • Prevented profile-local Xcode selection from changing the host-wide default when configured.
  • Documentation

    • Documented workload identities, result contracts, benchmark states, machine roles, and fleet enrollment procedures.

Fleet activation

Glaeda #1091 is merged. docs/fleet-enrollment.md now uses the repaired accept-local boundary for local CMUX profile execution, post-run node re-observation, acceptance-v2 publication, and the explicit transition to candidate eligibility.

The CMUX semantic result remains machine-neutral; Glaeda owns the local-attempt binding and physical admission evidence.