roadmap NOT-STARTED

523. Moving the job-mix supervisor into userspace, and the five permissions it turns out to need

script/board-image --job-mix --tftp reported NOT SEALED on every attempt on radon, which is what raised this. The move is investigated end to end and none of it is built, because every route to it runs through an architect's decision. What is below is the investigation, the one false premise in the brief, the five things a shell-spawned program would have to be allowed to do, and what each would cost. --features job_mix is how the number is taken.

Five of them, and they are not one question wearing five hats. Two are the system call surface (a thread's placement, a START return value), one is the spawn manifest, one is the rights the progenitor puts on a memory grant. One is an ABI fact about what a process may know about its machine. Any single one left unanswered leaves an instrument that either cannot be built or produces a number its own page says is not quotable.

What provoked it

Moved on 2026-10-12 (UTC) into what-provoked-it.md under §212 (a prose budget): why a job-mix card read NOT SEALED, measured. Why that finding is separate from this milestone and became milestone 563 (a seal check that reads bytes cannot see a check that was dropped).

The premise in the brief that is false, and it is the good news

The supervisor does not need the cycle-counter grant of milestone 229 (build the cycle-counter grant DECISIONS 139 decided), and the question does not arise.

kernel/src/job_mix.rs times a subrun with arch::timer::now(), which is CNTVCT_EL0 on aarch64 (kernel/src/arch/aarch64/timer.rs::now) and rdtime on riscv64 (kernel/src/arch/riscv64/timer.rs::now). user_mode_runtime::now() reads the same register with the same instruction on each, and is ambient at EL0 because the kernel opens CNTKCTL_EL1.EL0VCTEN and scounteren.TM in its own timer init. fixtures/src/job_mix_task.rs already self-times with it today.

The cycle counter is the other counter: PMCCNTR_EL0 and the cycle CSR, which milestone 228 (the cycle counters are closed by assumption, and on two architectures the assumption is a comment) deliberately closed and which only fixtures/src/cycle_counter_reader.rs reads. Nothing in this instrument wants it. So there is no system call to invent here and moho_abi::thread_control_block's deliberate absence of a grant method stays undisturbed.

A tick is a tick across the move, on aarch64 and x86_64. The one architecture where it is not is riscv64, and that is blocker 5 below.

What a userspace supervisor has to be able to do

The kernel supervisor is 382 lines and every one of its privileged acts has a userspace verb. The list is short and it is what makes the blockers concrete:

  1. Find job_mix_task's ELF in the initrd archive. nifefs::Fs::parse(archive).read(..) plus elf::Elf::parse, the shape components/src/root_supervisor.rs::start already uses.
  2. Create 67 rendezvous objects out of its own budget: one report, 32 go, 32 child-done, 2 echo. retype_into_kernel_object(budget, moho_abi::object_type::RENDEZVOUS), which fixtures/src/rendezvous_minter.rs proves works from EL0.
  3. Build and start 34 processes with a per-child grant set, each carrying its own rights. supervision_contract::build_child and start_child.
  4. Split 32 per-task budgets off its own region (job_mix::TASK_BUDGET_PAGES is 25 pages each, and a task needs its own because the map and spawn jobs spend it).
  5. Read the wall clock and the counter frequency, and print machine-readable lines crates/serial_console's recognizer can read.
  6. Print the placement census, because notes/job-mix.md's procedure reads it at step 3 and kernel/src/job_mix.rs's first BUGS entry says a number without it is not quotable.

Items 1 to 4 are all things some program in this tree already does. A shell child holding --mem may do 2, 4 and the building half of 3, and that is the shape of what follows.

The five blockers, each with what would close it

Blocker one: a shell child may build a process, and may lend it nothing it made

Every spending method of a memory region asks for WRITE alone (memory_region_invoke), and RETYPE_OBJECT makes spaces, threads, processes and rendezvous (memory_region_retype_object). A --mem grant arrives as moho_abi::rights::SPEND_ONLY, every right but GRANT (native_endowment in crates/system_initializer), so its holder can build a process and start it.

The mechanism withholds three things:

  1. GRANT on the grant. A retyped object carries its budget's rights (mint_child, milestone 824 (a retype mints no right its budget lacks)), and ThreadControlBlock::CAPABILITY_INSERT needs GRANT on what it inserts. So a child built from --mem receives nothing its builder made, and item 3's grant sets cannot be given. The exception: a program whose manifest declares the network gets every right on its grant (native_endowment), today network_echo_client, at 16 pages.
  2. Spawning by name. The spawn endpoint is the shell's (grant_plan::spawnproto), and §270 (a package manager holds an installer endpoint, not the spawn endpoint) keeps it from jig. A builder needs the ELF, blocker two.
  3. Pages beyond the shell's budget, which is blocker three.

A supervisor endows 34 processes built from job_mix_task, so it needs all three, and each changes the manifest, a published contract between the shell and the progenitor.

What would close it: a manifest field that asks for GRANT on the memory grant, as the network declaration gets. Or the progenitor endows this one program at boot rather than the shell. Both are an architect's. The second brings blocker 1b: a boot-built supervisor needs a wire protocol for the shell to ask it to run, anything two programs agree on.

Blocker two: a shell-spawned program never receives the initrd

crates/system_initializer's spawn_service builds every job with supervision_contract::build_child (:2470-2496), and build_child_space maps ELF segments, stack pages, an x86_64 timebase placeholder and endow.maps -- nothing else. The maps a normal job may receive are chosen at :2451-2462 and are three: a filesystem client page, the clock page, or the config page, with the comment "One extra mapping at most, today". INITIAL_RAMDISK_VIRTUAL_ADDRESS reaches only the kernel-spawned progenitor (mapped in user/entry.rs and user/progenitor_boot.rs), and a1 carries the manifest's integer argument rather than initial_ramdisk_len.

So a supervisor launched from the prompt cannot read job_mix_task's bytes. It is the same gap components/src/spawner.rs was designed around from the other side: that program is handed one image on purpose, "so 'build me program X' is not a thing that can be asked of it".

What would close it: a fourth maps kind and a manifest field declaring it, which hands a program the whole archive. That is a wide grant by this tree's standards and it deserves an argument rather than a patch.

Blocker three: a --mem grant tops out at 128 pages against a need of about 3,000

Each manifest declares its own range (MemoryGrantDeclaration::Required): 64 pages for memory_grant_depleter, 16 for job_sleeper and network_echo_client. Behind every range stands the shell's budget, spawnproto::SHELL_BUDGET_PAGES, whose share for --mem, pipes and the shell's windows is 128 pages; the rest stages images and holds jobs.

A supervisor needs, roughly: 34 children at about 40 pages each for segments, stack, page tables and a TCB; 32 task budgets at job_mix::TASK_BUDGET_PAGES (25); and 67 rendezvous pages. That is about 2,200 pages, call it 3,072 with headroom, 12 MiB. The progenitor's own root region is 12,288 pages (boot_progenitor), and the shell, the jobs pool and the image pool take 4,928 of them, so the memory exists, but no route takes it to a shell-spawned program. Widening the shell's 128-page share twenty-fourfold for one benchmark is a cost every interactive boot pays.

What would close it: a source for the pages outside the shell's budget, sized by the manifest that asks, or the boot-endowed route of blocker 1.

Blocker four: nothing lets a userspace thread learn where it was placed, so the census dies

This is the one that decides whether the instrument is worth moving at all, because without it the numbers are not quotable by the instrument's own published standard.

Milestone 240 (the soak reports what happened and not where, so an eightfold difference cannot be explained) found that placement decides throughput on radon by up to fifteenfold. kernel/src/job_mix.rs answers it with sched::spawn_reporting_placement (sched/inspection.rs), which returns the core the kernel picked, and prints a job-mix-census: line per core. crates/serial_console/src/lottery.rs reads those lines to judge a draw, and notes/job-mix.md step 3 tells the operator to read them before reading any number.

There is no userspace path to that fact, and it is not a gap in one place:

Three options, and all three are an architect's:

Doing none of them is an option and it should be stated as one. The supervisor could print the per-task subrun ticks it already collects and let an uneven spread stand in for the census. That is strictly weaker: it says the arrangement was uneven without naming a core, lottery.rs cannot judge a draw from it, and notes/job-mix.md's step 3 would have to be rewritten to ask for less. This lane's recommendation is that it is not enough, because the instrument's own page says a number without the arrangement is not a number.

Blocker five: on riscv64 a userspace program cannot learn the counter frequency, and radon is where the number is taken

user_mode_runtime::cntfrq() on riscv64 returns a hardcoded 10_000_000, and its own doc says why: RISC-V has no register that reports the timebase, it lives in the device tree, and "userspace cannot read it". Radon's is 4 MHz (design/roadmap/0375-e3-on-radon-with-real-cycles.md, bench: cntfrq 4000000). The kernel supervisor reads the real value through arch::timer::frequency().

So a userspace supervisor on the one board this milestone's number is taken on would report jpm_median 2.5x too high, silently, while its ticks_median stayed correct. That is the failure mode this tree fears most: a number that looks right.

The obvious fix is the timebase page counter_frequency_contract already defines, extended from x86_64 to riscv64. It does not work here, and the reason is already on the roadmap. Milestone 167 (handing a computed page to a userspace-built child: closing the x86_64 timebase page's delegation gap) records that a process built by build_child_space gets a zeroed placeholder, because nothing mints a capability naming the kernel's frame. A shell-spawned supervisor is built exactly that way. So blocker 5 is gated on milestone 167 before it is gated on anything else.

The cheap alternative is to make the frequency the program's declared integer argument (job_mix_supervisor 4000000), which needs no surface change and is honest about being an input. It is rung four of AGENTS.md's ladder: a person types a number, and typing the wrong one produces a plausible wrong answer.

What the move would do to the number, stated now so the next lane does not have to re-derive it

Two changes, and the first is the reason to want the move:

The measurement would include the supervisor's own scheduling, and that moves the instrument closer to the workload it claims to model. Today the supervisor is a kernel thread calling sched:: directly: it releases tasks and drains reports without paying the EL0 trap, and its own runnability is not the scheduler's problem in the way a process's is. A userspace supervisor's releases and drains are 33 real svc round trips per subrun at the top of the sweep, inside the timed window, and the supervisor is a 35th process the scheduler must place and run. Under DECISIONS §96 (process kernel or event kernel) that is not noise: the spawn and scheduling costs are the subject. The honest framing is that the number would go down and mean more, not that the move is free.

It is a third instrument, and the Results table would need a third row shape. The 2026-09-16 radon curve is already incomparable with anything taken after 2026-09-19. The mix went from five job kinds to seven and the statistic from best-of-3 to median-of-21, and notes/job-mix.md's own table says the field names changed on purpose so an old parser finds nothing. A userspace supervisor would break comparability a second time and in a different place: same mix, same statistic, same field names, different timed window. That is the dangerous kind, because nothing in the line would look different. Whoever builds this owes the Results table a column saying which supervisor produced a row, and owes the printed lines something a script can tell apart. Milestone 324 (the bench console cannot speak to any of the three boards) already applied the same reasoning to the markers.

The kernel feature stays, and that is a finding rather than a deferral

The brief's fourth requirement was to decide whether --features job_mix is deleted or kept as dead weight, and it is right that keeping it as a fallback would be the failure mode. It is kept because nothing replaces it, and the argument for deleting it is exactly the one that is blocked above. What it costs is now written down rather than rediscovered: it diverts the tour past boot_progenitor, so a job-mix card verifies no archive, and sealed_pair misreports that as a refusal. Both halves of that are recorded where a reader meets them.

What this lane did

Investigation and records only. No code changed, no name was coined, design/decisions/ and design/fatal-risks/README.md were not touched. Added: this block; the sealed_pair proposal; a BUGS entry in notes/job-mix.md and one in crates/sealed_pair so the next bench evening does not spend an hour on a tool that cries wolf.

Follow-on

BUGS

Index row

Investigated and stopped at a fork rather than built. Moving kernel/src/job_mix.rs (382 lines) to a userspace program would delete the special build whose diverted tour drops measured boot and makes sealed_pair misreport a matched card as NOT SEALED. It would measure the supervisor's own scheduling, which DECISIONS §96 says is the subject. The brief's premise that it needs milestone 229's cycle-counter grant is false: the clock is the ambient generic counter and userspace already reads it with the same instruction. Five real blockers, each needing calef. A shell-spawned program may build a process from its --mem grant but cannot endow it, holding no GRANT. It cannot spawn by name, never receives the initrd, and tops out at the shell's 128-page share against ~3,000. It cannot learn where its threads were placed (so milestone 240's census dies, and three options for fixing that are priced here). On riscv64 it cannot learn the counter frequency, which would make radon's jpm_median silently 2.5x high and is itself gated on milestone 167.