Skip to content

Provider frame validation and supervision

The cell monitor is the trusted boundary between the nucleus's authority and an untrusted runtime provider. For each invocation it receives facts the nucleus already authorised, loads the method's declaration from the prepared compiled interface, and builds the provider frame itself. Which method runs, with which schema, effect class and retry rule, comes from the sealed interface; the provider is told, and its answer is checked against the same declaration. This page covers how a dispatch is authorised, what the monitor checks, and how it checks what the provider reports.

The dispatch path

flowchart TB
  subgraph NUC["NUCLEUS AND HOST"]
    direction TB
    AD{{"Admit and encode<br/>dispatch authority"}}
    T[("Task created, admitted<br/>and queued")]
    EFF["DispatchProvider effect<br/>for one attempt id"]
    AD --> T --> EFF
  end
  subgraph MONBOX["CELL MONITOR, TRUSTED"]
    direction TB
    DECL[("Method declaration<br/>from the prepared compiled interface")]
    CHK{{"Checks the dispatch"}}
    FR["Builds the provider frame"]
    CMP{{"Checks the completion"}}
    DECL --> CHK --> FR
    DECL --> CMP
  end
  PROV["Runtime provider<br/>untrusted"]
  EFF --> CHK
  FR -->|"dispatch"| PROV
  PROV -.->|"completion"| CMP
  CMP -.->|"ProviderCompletionAccepted receipt"| NUC

Authority before the task

The nucleus host admits and encodes the provider dispatch authority before the task is created. A refused dispatch therefore creates no task. Once the task exists, the nucleus admits its finite deadline and cancellation scope, queues it, installs the encoded dispatch under its exact attempt id and commits the matching DispatchProvider effect.

What the monitor checks

For every dispatch the monitor checks, from its own records:

  • the task, call and attempt identity;
  • the runtime-closure, capsule and interface identity;
  • the export and method ordinals, against the sealed interface;
  • the argument bindings, against the declared parameter types;
  • the deadline, the cancellation scope and the bounded encoded size.

For every completion it checks the outcome against the same sealed declaration: the declared return type and the declared-error bindings of that method. An accepted completion becomes the ProviderCompletionAccepted receipt. See Call and resource invocation and Exception adaptation and result classification.

Checking what the provider reports

Every provider report is checked against something the monitor holds:

Report Checked against
Preparation report The exports the prepare request declared
Release receipt The resource id the monitor named
Health, quiesce and termination reports The attempts the monitor dispatched
Resource or stream proposal The interface id and resource ordinal of the sealed interface

A report that names something outside the monitor's record is refused as a protocol violation. Process exit, deadline expiry and probe failure are observed by the monitor directly. See Guest supervision.

One path for every provider

The monitor drives every provider through RuntimeProviderProtocolV1, and the checks on this page apply identically to each. Interpreter mechanics such as import, object lifetime and exception handling stay inside the provider process. See The provider protocol.