#1992·astrid

quota set: allow operators to set a principal's CPU rate (--cpu-rate)

Author: jvsteinerCreated Sep 25, 2026Updated Sep 25, 2026

Problem

Operators cannot raise a non-admin principal's CPU rate from the CLI. astrid quota set has no flag for max_cpu_fuel_per_sec (crates/astrid-cli/src/commands/quota.rs, SetArgs). astrid quota show prints cpu-rate, but only the admin QuotaSet request and PUT /api/sys/principals/{id}/quotas can change it.

This blocks Codewall (unicity-aos/codewall#43).

Why it matters

The per-invocation fuel budget is the principal's CPU rate divided by max_in_flight_calls (invocation_fuel_share, crates/astrid-capsule-types/src/fuel_ledger.rs). With the defaults (2e9 fuel/s, 4 in flight), each call gets 500M fuel.

Codewall's enforcer verifies and compiles a signed policy in one activate_policy call. A real policy (111 rules, 253 regexes, ~68 KB) needs about 2.25B fuel, which is about 0.25 s of CPU. Under a non-admin principal with default quotas, the call traps with wasm trap: all fuel consumed by WebAssembly. The endpoint cannot activate its first policy. It works under the admin principal because of the 10B per-call ceiling.

The quota works as designed. Codewall needs a supported and bounded way to give one principal a larger rate.

Proposal

  1. Add --cpu-rate <RATE> to astrid quota set. It sets max_cpu_fuel_per_sec and accepts the same form that quota show prints (for example 12G/s).
  2. Optionally, also add --in-flight <N> for max_in_flight_calls.

Codewall's installer would then run:

astrid quota set --agent claude-code --cpu-rate 12G/s

That gives each call 3B fuel, which leaves headroom over the ~2.25B needed. Only that principal changes.

Alternative considered

Raising DEFAULT_MAX_CPU_FUEL_PER_SEC would fix Codewall too. But it gives every non-admin principal more CPU, so a per-principal flag seems safer.

Acceptance

  • astrid quota set --agent <p> --cpu-rate <RATE> updates max_cpu_fuel_per_sec and leaves the other quotas unchanged.
  • astrid quota show reflects the new value.
  • The same authorisation as the other quota set fields applies (quota:set / self:quota:set).
  • A test covers parsing and a round-trip through QuotaSet.

Codewall is also working on lowering its compile cost. This flag is still the supported way to fit legitimate larger workloads.