Skip to content

The return lane

Everything a project runtime reports leaves the kernel on one stream: the return lane. It is a durable, digest-chained journal of envelopes for one project runtime. The kernel appends, the data plane node pulls and acknowledges cumulatively, and the lane itself assigns every sequence number and chain digest. The sequence numbers fix the order of the envelopes, and the digest chain makes a removed or altered envelope detectable. This page covers the envelope, appending, pulling and acknowledging, and how the lane closes.

One lane per project runtime

flowchart LR
  subgraph KERNEL["PROJECT KERNEL"]
    direction TB
    PROD["Producers<br/>evidence sink, status, logs, faults"]
    subgraph LANE["RETURN LANE"]
      direction TB
      J[("Journal<br/>seq, prev_digest, digest")]
      CUR[("Ack cursor<br/>last_acked_seq")]
    end
    PROD -->|"append draft"| J
  end
  subgraph NODE["DATA PLANE NODE"]
    direction TB
    PULL["Pull from next_seq"]
    ACK["Cumulative ack"]
  end
  J -->|"page of envelopes"| PULL
  ACK -->|"last_acked_seq"| CUR

The journal and the ack cursor live in the kernel's continuity store and survive a nucleus restart, so a node resumes from the acknowledged position. See The continuity store and cursor.

The envelope

Field Set by Holds
seq The lane Position in the lane
prev_digest, digest The lane The chain: each envelope's digest covers the one before it
context The lane, fixed when it opens workspace_uuid, assignment_id, run_id, node_id, trace_id
kind The producer What the envelope reports
category The producer status, event, log, evidence or fault
emitted_at The producer Emission time
terminal The producer Whether this envelope ends the runtime's lane
payload The producer The body

A producer supplies the kind, the category, the emission time, the terminal marker and the payload. An append that tries to set seq, prev_digest or digest is rejected. The lane encodes each envelope canonically before hashing. A running lane serialises producers through one live cursor and writes the envelope followed by its resulting cursor as one ordered append. The live cursor advances only after that append succeeds; reopening the lane verifies the durable cursor against the journal tail. The same canonical encoding is used wherever an outcome is fingerprinted for replay comparison. See The five envelope categories.

Evidence before visibility

The nucleus writes authority transitions through the lane. The digest of the committed envelope becomes the nucleus's effect receipt, so a terminal transition becomes visible outside the kernel after its evidence is in the journal. See Evidence effects.

Pull and acknowledge

The node pulls a page of envelopes from a sequence number and acknowledges cumulatively: an ack for a sequence number covers every envelope up to it. A page returns its envelopes with next_seq, last_acked_seq, max_seq and whether the lane is terminal. A pull returns 100 envelopes by default and at most 1,000. A pull from the acknowledged cursor returns the oldest page after it.

Acknowledgement advances the durable cursor immediately. The lane keeps the most recent 10,000 acknowledged envelopes as its recovery window, and acknowledged history occupies at most two windows before the lane compacts it. A reconnecting node resumes from last_acked_seq, and every next envelope continues the digest chain from the last envelope the node acknowledged.

An ack is accepted or rejected with one of five states:

State Raised when
gap The ack names a sequence number beyond the last envelope appended
regression The ack is behind the current cursor
post_terminal The ack is past the terminal envelope
non_owner The caller does not own this runtime
stale_fence The caller's ownership fence is superseded

A rejected ack carries an error_class, whether it is retryable, and retry_after_seconds. A gap, regression or post_terminal rejection is deterministic: the node's view has diverged from the lane, and it reconnects and resumes from last_acked_seq. See Cumulative acknowledgement upstream and Recovering the DP-kernel link.

Closing the lane

Two different things are called terminal. An authority subject, such as one task or one channel, ends with an evidence envelope whose terminal marker is unset, and the lane stays open. The project runtime ends with the runtime's terminal envelope, whose terminal marker is set. The node closes its continuity session on that envelope, and a drain completes on it. See The terminal envelope.