quota set: allow operators to set a principal's CPU rate (--cpu-rate)
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
- Add
--cpu-rate <RATE>toastrid quota set. It setsmax_cpu_fuel_per_secand accepts the same form thatquota showprints (for example12G/s). - Optionally, also add
--in-flight <N>formax_in_flight_calls.
Codewall's installer would then run:
astrid quota set --agent claude-code --cpu-rate 12G/sThat 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>updatesmax_cpu_fuel_per_secand leaves the other quotas unchanged.astrid quota showreflects the new value.- The same authorisation as the other
quota setfields 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.
Source: astrid-runtime/astrid