Skip to main content

Module internal_work

Module internal_work 

Source
Expand description

Internal execution work orders for the Model→Inference single-service boundary (user-approved D5, PR1678).

Model is the authorization authority for Model-routed operations. Its pinned, allocated Inference instances are subprocessors: they execute work only for their owning controller and never form an independent authority domain. When Model forwards an already-authorized operation to one of its pinned instances, it mints a short-lived, Model-signed internal work token (typ: "iw+jwt") instead of relaying the caller’s credential:

  • the token is bound to the pinned controller key (cnf.jwk) and is verified against that pinned key — not against the CA key source;
  • aud names exactly one allocated instance; tenant/model must match that instance’s binding;
  • resource/operation pin the exact downstream dispatch coordinate the controller already authorized at ingress;
  • exp is capped by the caller’s own expiry and a hard 120 s lifetime; jti is admitted once per worker process;
  • the original caller’s verified claims snapshot rides along so subject-keyed TTT state, stream ownership, and ledger accounting keep attributing to the ORIGINAL caller — never to Model.

This token is authority nowhere else. The generic verify_claims pipeline rejects iw+jwt at every service (the trait hook defaults to deny); only a service operating a pinned execution boundary overrides the hook. It is never a bearer for Policy, Registry, Discovery, OAI, or any other control-plane surface, and it is never a substitute for a holder credential crossing an EXTERNAL boundary.

Structs§

InternalWorkClaims
Claims of one internal execution work order.
InternalWorkContext
The verified work order installed on an crate::service::EnvelopeContext.
InternalWorkScope
The exact downstream dispatch coordinate one work order authorizes.

Constants§

INTERNAL_WORK_ISSUER
Informational issuer marker. Verification is pinned-key, not issuer-based; a non-empty issuer deliberately avoids the #328 empty-iss in-process shortcut so a future subprocess/UDS leg needs no locality exception.
INTERNAL_WORK_JWT_TYP
JOSE typ for internal execution work orders.
MAX_IAT_SKEW_SECS
Maximum accepted clock skew between mint (iat) and admission.
MAX_LIFETIME_SECS
Hard upper bound on one work order’s lifetime. Model caps exp by the caller’s own expiry as well; this bound keeps a leaked token’s window short regardless of the caller credential.

Functions§

admit_internal_work_jti_once
Admit a work-order jti exactly once. Entries expire at the token’s own exp; the cache reclaims in expiry order, is capacity-bounded (deployment-configurable), and fails closed when full of unexpired entries or misconfigured. This is worker-local defense in depth ON TOP of the envelope replay gates, not a replacement for them.
configure_internal_work_replay_capacity
Configure the deployment replay-cache capacity (validated, once-only — it must be set before the first admission materializes the cache).
encode_internal_work
Encode and sign a work order (typ: "iw+jwt", pinned Ed25519).
validate_replay_capacity
Validate a requested replay-cache capacity.
verify_internal_work
Verify a work order against the PINNED controller key (never a CA key source) and bind it to one expected instance audience.