mesh: a grant is decided by JCP's runtime, so expiry, caveats, the model and spend bind #294
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/mesh-grant-decided-by-jcp"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The defect
Mesh honoured a JCP grant by checking three things: the issuer signature, that the capability permits
inferon the request, and that the grant's budget covered the request's ceiling. Nothing else was checked:NotAfter,NotBefore,PayloadIs,MaxCostUjand the newModelIn(#285) were ignored at Mesh.mesh-core had no unit test of its grant path.
The fix
The steward holds a jcp-runtime
Runtimeand decides every grant in JCP's two-phase metered path, the same code every other JCP enforcement point uses:ModelIndoes not permit is inadmissible, and so is one that names no model. The route is the cheapest permitted backend, and the candidates record why the others were refused (Router::route_where).inferon the request's content id, the prompt hash as payload, and the chosen backend's weights asmodel. Signature, expiry, revocation and every cost-independent caveat apply, and what the grant has left must cover the request's ceiling.grant_breach, which is omitted when absent.Engines name their weights through a new
ServingEngine::weights_digest(), which defaults toNone, so existing engines are unchanged.The refusals that existed keep their errors (
GrantInvalid,Unauthorized,BudgetTooLow).BudgetTooLownow reports what the grant has left. The spec (§2, §6.1, §7, §8) and the README describe the new phase order.Stated, not fixed
These are now written into SPEC §8:
Checked
On the build host:
ModelInrouting, a swapped model, a per-call cost breach, and the refusals that already existed.mesh/1vector is byte-identical tomesh/conformance/v1.mesh-engine-gguf/ggufandmesh-openai/serverbuild.🤖 Generated with Claude Code