Work clock
"clock" that uses instructions, not the OS clock.
Summary by cubic
Adds a third execution clock, Work, that counts executed work instead of reading the OS clock, so duration limits work on every platform — including WebAssembly, where clocks stand still during compute and which previously accepted only wall time. The VM charges units per bytecode instruction, Opcode::extra_work weights costlier ones, native operations (big-int arithmetic, regex, JSON, string scans, sorts, allocations) charge per cost, and monty-alloc counts allocated bytes as a floor. Units convert to time at a fixed per-build rate, so budgets and reported durations are deterministic across runs rather than wall-clock estimates.
Work sessions arm no wall duration backstop, like CPU sessions: counted time doesn't predict how long a turn takes, so a wall backstop would end healthy turns. request_timeout stays the only wall bound. execution_clock='work' / executionClock: 'work' select it on the Python, JS and WASM pools; workers that predate the protocol refuse work sessions, and dumps still require the saved clock on load.
Charges also cover work that produces no result: failed regex matches, re.split without groups and with a negative maxsplit, three-argument pow's base reduction, a raising json.dumps, non-ASCII character-offset searches, and print separators and ends. Short dividends are not charged, and the wasm pool rejects executionClock: null.
Calibration
make fit-work-clockfits every weight at once from opcode and work-event counts and measured wasm time, regeneratingop_weights.rsandwork_weights.rs; no weight is written by hand.make calibrate-work-clockmeasures per-category, per-construct and corpus scripts on the work and wall clocks, natively and in WASM, failing on more than 3× category drift; CI runs the reports without the timing check.- Native and WASM builds get separate
NANOS_PER_UNITrates. re.subexpands into a scratch string instead of revalidating the result per replacement, fixing quadratic behavior.