Skip to content

Handle import and export

Each cell monitor maintains its own local handle table. A handle becomes usable only after nucleus authority has been installed into the table that owns its slot. This page covers source-handle installation, local validation and the transactional import of attenuated authority into another cell.

The local table boundary

flowchart LR
  subgraph NUC["NUCLEUS AUTHORITY"]
    direction TB
    AUTH{{"Resource installation authority"}}
  end
  subgraph MONA["CELL A MONITOR"]
    direction TB
    TAB[("Cell A handle table")]
    CHECK{{"Cell, epoch, slot and generation"}}
    TAB --> CHECK
  end
  subgraph MONB["CELL B MONITOR"]
    direction TB
    OTHER[("Cell B handle table")]
  end
  AUTH -->|"targets cell A"| TAB
  CHECK --> OK["Validated handle"]
  OTHER -.->|"same numeric slot has separate meaning"| CHECK

The installation authority names the table cell, table epoch, resource slot, resource generation, interface id and source handle. The monitor accepts it only when the handle's owner cell and epoch match its own table. A slot already present in that table is refused.

Validation

The hot validation path compares the supplied handle with the installed entry:

  • table cell and cell epoch;
  • handle slot and generation;
  • owner cell and owner epoch;
  • resource slot and generation;
  • interface identity and rights.

The comparison uses the whole entry. Numeric equality of a slot across two monitors retains separate authority in each table, and a generation from an earlier lifetime is stale.

An entry that has reached a terminal resource state retains the fault that ended it. Validation returns that fault before applying the ordinary active state check, so revocation and owner loss remain distinguishable from an unknown slot or generation.

Source handle installation

Resource export creates the first local handle in the owner cell. The owner monitor commits two local mutations together: it installs the provider-local resource in the resource slot table and installs the nucleus-issued source handle in the handle table. The monitor returns one receipt only after both mutations succeed.

The caller-visible result contains the local handle reference. The provider object stays reachable through the owner resource slot, so runtime-language identity remains confined to the owner process boundary. See Resource slot table and Handle authority.

Caller-visible means visible to the calling cell inside the project kernel. Resource, stream and buffer references stay inside the project kernel, including a reference nested inside an otherwise ordinary typed value. The return lane carries evidence about them, so a local handle stays local to the kernel and never becomes a cross-plane identifier.

Transactional import

The nucleus coordinates one transfer through the existing cell control channel. Each step returns a receipt carrying the transfer id, step, local handle, lease generation and revocation epoch.

flowchart TB
  subgraph NUC["NUCLEUS"]
    direction TB
    TX[("Transfer record<br/>transfer id, lease generation")]
  end
  subgraph A["CELL A MONITOR"]
    direction TB
    SRC[("Source entry")]
  end
  subgraph B["CELL B MONITOR"]
    direction TB
    RCV[("Receiver entry")]
  end
  TX -->|"1. prepare source"| SRC
  SRC -.->|"source reserved"| TX
  TX -->|"2. offer receiver handle"| RCV
  RCV -.->|"pending import"| TX
  TX -->|"3. commit receiver handle"| RCV
  RCV -.->|"receiver active"| TX
  TX -->|"4. invalidate source handle"| SRC
  SRC -.->|"source invalidated"| TX

Transfer record drives four steps, and each monitor applies only the step addressed to its own cell and epoch. Every dashed edge is a receipt, and the next step is issued only after the receipt for the previous one is admitted.

Cell A remains the usable owner until it acknowledges preparation. Its local entry is then ReservedForTransfer, so local validation refuses new use. Cell B first records PendingImport, which remains unusable. Cell B changes the entry to Active only for the nucleus-issued commit step. The nucleus then invalidates cell A's entry and advances its generation.

The completed transaction leaves one active local entry in cell B. Its rights are the intersection admitted for the resource and the transfer attenuation. The numeric slot remains meaningful only inside cell B's table.

Cells admitted into one project kernel share the nucleus authority state that coordinates this transaction. Each cell retains a separate monitor table and provider object space. Each assignment contributes its cell, grant and closure identity to that one project-kernel state, while the source and receiver mutations occur only in their own monitor processes.

Borrowed invocation authority

A call on an imported handle uses a borrow. The caller monitor derives a borrow narrower than the handle for the exact task and call and records that scope as active. A borrow never carries Transfer, cannot be stored in a local handle table, and cannot appear in a returned resource, stream or buffer.

Synchronous use has a scope of the form task:<task-id>/call:<call-id>. An asynchronous call must also present a new explicit extension identity; the monitor refuses a blank or reused extension. The borrow remains usable only while its recorded scope, handle slot and generation all match. Settling the attempt returns the channel credit and removes the scope and extension, so a retained borrowed value no longer validates after completion.

The durable local-handle entry remains in the caller monitor. Borrowing neither moves the underlying resource nor exposes the provider-local object that backs it.

Replay and recovery

Every transfer effect has one deterministic deduplication identity. Delivery loss or an unacknowledged completion reissues the current step with the same authority. A monitor accepts that replay only when its local entry already matches the transfer lineage and the expected state. A duplicate or out-of-order receipt is refused.

Nucleus death is different from acknowledgement loss. It ends the old kernel epoch, terminates the old cell processes and makes their local handles stale. An in-progress transfer is recorded as terminally aborted without asking either old monitor for cleanup receipts. The new epoch never resumes a commit against an endpoint from the dead epoch.

Lease and abort behaviour

The transfer lease uses a project-kernel monotonic clock owned by the nucleus host. The host samples it once for an operation and supplies that fact to the deterministic nucleus in microseconds. An invocation, provider or transport frame cannot supply the clock value. The lease records the last observed time. Renewal requires retained transfer authority, a positive extension and an unused renewal allowance.

Expiry during an active call fences renewal and allows the bounded grace period to settle the call. Expiry after that point aborts the transfer. Cleanup depends on the state reached:

Condition Cleanup order
Receiver committed Discard cell B's entry, then restore cell A's entry
Receiver pending Restore cell A's entry, then discard cell B's entry
Source cell ended Discard cell B's entry
Receiver cell ended Restore cell A's entry
Nucleus ended No old endpoint cleanup; both old-epoch entries are stale
Revocation Discard cell B's entry, then invalidate cell A's entry

Discarding an offer that never reached cell B is an idempotent success. A source-cell or receiver-cell failure requires cleanup receipts only from the surviving endpoint. These rules leave the transfer in one terminal state: committed with the source invalidated, or aborted with the surviving authority settled.

Ending a resource lifetime

The nucleus indexes every handle and in-flight transfer by resource slot and generation. Close, revocation, lease expiry and session end terminate that exact lineage. Provider exit and owner-cell death fence caller handles through the owner epoch, while cleanup targets only the surviving monitors.

A transfer lease and a resource lifetime are different authorities. The transfer lease bounds only an in-flight move between local handle tables. Once installed, a resource remains bounded by the expiry of its admitted channel grant. The kernel observes both using monotonic time and owns each expiry decision.

flowchart TB
  subgraph NUC["NUCLEUS AUTHORITY"]
    direction TB
    LINEAGE[("Resource lineage")]
    TERM{{"Terminal cause and fault"}}
    LINEAGE --> TERM
  end
  subgraph CALLERS["CALLER MONITORS"]
    direction TB
    HANDLES[("Local handle entries")]
    CALLS[("Borrow scopes and calls")]
  end
  subgraph OWNER["OWNER CELL"]
    direction TB
    SLOT[("Owner resource slot")]
    PROVIDER["Provider-local resource"]
    SLOT --> PROVIDER
  end
  TERM -->|"invalidate exact handles"| HANDLES
  TERM -->|"settle exact attempts"| CALLS
  TERM -->|"release while owner is live"| SLOT

Resource lineage selects the affected authority directly. The caller monitors invalidate matching entries and settle their matching borrows and credits. A live owner cell removes its slot and obtains a provider release receipt before committing local cleanup. Owner death treats process exit as destruction of the provider-local object; cleanup receipts come from the surviving monitors.

Terminal fault Caller-visible condition
stale_handle Explicit close, lease expiry or session end ended the resource lifetime
owner_lost The provider or owner cell ended
revoked Authority explicitly revoked the resource
transfer_failed Resource termination intersected a handle installation or transfer

Every terminal transition emits resource_authority_terminated. Each monitor cleanup acknowledgement emits resource_cleanup_accepted with the resource slot, generation, terminal cause, terminal fault and effect receipt digest. These records use the same receipt-backed return lane as the assignment lifecycle.

Continue with Cell control channel for effect delivery and correlation.