ehgraph Inside the Server
PARTIAL
The server can run the noetl-cluster graph in-process. At server
v3.161.2 that graph is off unless the deployment turns it on, and
on the production reading of 2026-11-22 it was on and idle
(15.1). This page is PARTIAL because the
switch is off by default and because the embedded engine is the
untagged ehgraph rev f200516.
The same engine runs standalone. The log, the tools, the grants, the
sessions, and the budgets are the same in both modes
(docs/wiki/Embedding.md). The standalone server is what serves a
domain such as network. This page is the embedded path.
The mount, and the switches
NOETL_EHGRAPH_EMBEDDED must be exactly true
(src/ehgraph_embedded.rs:77). Unset, the module's own comment says
not a byte of ehgraph runs, no route is mounted, and the server
behaves as the release before the pin. When it is true, the server opens EhGraph::open_embedded_async
from the TOML at NOETL_EHGRAPH_CONFIG and mounts graph.router() at
/ehgraph/noetl-cluster (ehgraph_embedded.rs:90). That router is
HTTP and MCP. The embedded instance opens no Bolt listener
(15.3).
| Switch | Default | What it arms |
|---|---|---|
NOETL_EHGRAPH_EMBEDDED | off (must be exactly true) | Open the embedded graph and mount it |
NOETL_EHGRAPH_CONFIG | unset | Path to the ehgraph TOML (instance, data_dir, backup_prefix, budgets, grants). It holds bearer tokens |
NOETL_EHGRAPH_HOST_REPLICAS | unset, and unset refuses | Must be 1. There is no default |
NOETL_EHGRAPH_HOST_ORDINAL | derived from HOSTNAME | Optional StatefulSet pod index. Only 0 may write |
NOETL_EHGRAPH_TOPOLOGY_WRITER | off (must be exactly true) | Project the instance registry into the graph |
NOETL_EHGRAPH_TOPOLOGY_TOKEN_FILE | unset | A file holding a bearer token. The writer does not start without a readable, non-empty file |
NOETL_EHGRAPH_TOPOLOGY_NAMESPACE | topology | The namespace the registry projection writes (src/instances/graph.rs:45) |
The domain and the namespace are different. The embedded domain is
noetl-cluster (EMBEDDED_DOMAIN, ehgraph_embedded.rs:88). The
registry writes the namespace topology unless the namespace variable
is set. Any other domain in the TOML is refused: network runs
standalone (prepare_config, ehgraph_embedded.rs:189-194).
auth.mode = "disabled" is refused for an embedded instance unless
auth.allow_disabled_embedded = true is also set, for a local-only
host (crates/ehgraph/src/lib.rs:189-197 at f200516).
If the graph is armed and then refuses or fails to open, the server
still serves everything else. The refusal is logged at error, and
every request under /ehgraph/noetl-cluster answers 503 with the
reason (ehgraph_embedded.rs:34-39, 296-312). No partial instance
is left running.
The single-writer declaration
An embedded instance is a single writer. The data-directory lock only
covers one volume: two server pods, each with its own volume, would
each take the lock and become two primaries. The server therefore
refuses to open unless the deployment says it is the only writer
(ehgraph_embedded.rs:15-31):
NOETL_EHGRAPH_HOST_REPLICASis set, and set to1.NOETL_SHARD_COUNT > 1refuses, and so doesNOETL_EXECUTION_AFFINITY=true.- The pod ordinal (
NOETL_EHGRAPH_HOST_ORDINAL, otherwise the trailing-NofHOSTNAME) must be0. ehgraph enforces that itself (crates/ehgraph/src/config.rs:98-103).
The TOML must not carry its own [embedded] section. The declaration
comes from the deployment (ehgraph_embedded.rs:197-202). ehgraph then
checks the declaration, a process-wide claim on the instance_id and
the domain, and the directory lock.
docs/wiki/Embedding.md says so, and the server comment repeats it. A
host that runs two replicas and declares one defeats the check. The
server's own refusals (shard count, execution affinity, ordinal) are
the other half, and they only see the configuration they are given.
start_maintenance runs the session sweep and the backup loop on the
server's runtime. Shutdown waits up to 10 seconds, drains in-flight
calls, and releases the lock (SHUTDOWN_TIMEOUT,
ehgraph_embedded.rs:93).
The instance graph the registry writes
The server is the only writer. An instance never opens the graph
(src/instances/graph.rs:3-6). The projection runs only when all three
of these hold: the writer variable is exactly true, the embedded
graph is running, and the token file is readable
(graph.rs:219-239). Missing any one of them, the registry works as
it does with the writer off, and nothing is written.
One registration becomes nodes and edges in the namespace
(graph.rs:6-17):
| Element | Id | Type |
|---|---|---|
| Node | control:<server id> | control_plane |
| Node | instance:<instance id> | noetl_instance |
| Node | pool:<name> | pool |
| Node | playbook:<path or glob> | playbook |
| Edge | instance → control | registered_with |
| Edge | instance → pool | in_pool |
| Edge | instance → playbook | can_run |
| Edge | instance → instance | knows, from known_peers, and only toward a peer that is live |
| Edge | instance → instance | delegated_to, one edge per task handoff |
Every element carries source: instance-registry. A lapsed lease is
retired with graph.deactivate by that source and not_seen_since,
which is the soft deactivation in 15.2. The node
stays, so "who knew whom, and when" is still answerable after the
instance is gone.
ehgraph rejects an edge to a missing or inactive node and rejects the
whole batch with it. knows and delegated_to therefore go in their
own batches, one edge each. A peer that is not in the graph yet costs
that one edge, and the instance's own record still commits
(graph.rs:24-26).
As 15.1 records from a search of server
src at v3.161.2, no server code calls graph.query,
graph.neighbors, graph.path, or graph.cypher. The writer can
project the registry. Nothing in that tree reads the projection back.
Rollback refuses a format it does not know
An embedded graph rolls back with the server. Every on-disk JSON file
carries a format field and is decoded with no unknown fields
(crates/ehgraph-store/src/format.rs at f200516). STORE_FORMAT is
2 (format.rs:49). Format 1 is the MVP shape (a file with no
marker counts as 1). Format 2 is a compacted namespace manifest:
floor_version and floor_snapshot. A file is written at the lowest
format that describes it, so a directory stays at format 1 until
compaction has actually run on a namespace. Compaction is off by
default (15.6).
A file newer than this build, or a field this build does not know,
makes open refuse, with a message that names the file. The server's
pin comment says the /ehgraph/noetl-cluster routes then answer 503
(Cargo.toml:241-246). The graph does not silently drop the fields it
does not understand. The recovery is to roll the server forward, or to
restore a backup the older build took.
docs/wiki/Embedding.md at f200516 says noetl-server pins this repo
at 760f572 (noetl/server#557, 2026-11-07). Server v3.161.2 pins
f200516 (Cargo.toml:250), the revision this chapter describes.
The page lists what that older pin already contained: GCS backups,
bounded idempotency keys, memory budgets, compaction left off, and the
read/write path fixes. Those are in the tree at f200516. This chapter
did not diff 760f572 against f200516 commit by commit. The server
pin moves only in a chore change, so moving it does not by itself cut
a server release (Embedding.md).