One late order across a site: the trail, two asks and a drafted narrative
This page follows one blocked order through a three-Node practice site. You read its trail across the Nodes, ask the ERP Node what the MES says about it and what a shortage would affect, have the MES draft a narrative of it, and then see what each of those does when the model is switched off or cannot be reached. A test runs the commands on this page against a stand-in model. One run against a real model is shown, and labelled as one run.
Every value on this page is invented. The order, the lot, the quantity, the reason it is blocked and the model's answers are made up for this walk-through, or written by a model about made-up data. Nothing here is a real order, and nothing says a real site would read this way.
This is test tooling, not part of the public API. The site script, its two ask commands and the stand-ins behind them may change in any release, and the stability policy (public-api-stability.md) does not cover them. The trail and the narrative routes they show are documented in order-trail-assembly.md and order-narrative-route.md.
What you need
- A running practice site.
deployment/practice_site.sh up --model NAME --inference-endpoint URLbuilds it on one host: three Nodes (MES, ERP and Production Scheduling), each with a database of its own, against invented target systems.deployment/practice_site.sh --helplists its prerequisites. This page assumes it is up and that the order is blocked.upreturns when the last row is played, not when the MES has read it, and the MES reads its rows one after another, asking the model about the weld reading on the way. With a model that is warm that is about two seconds. A model that has to load first can take much longer for its first answer (one took 17 seconds), and the order readsin-progressuntil the MES has read the last row. Ifask-order-statusprintsin-progress, wait a few seconds and ask again (each ask files an entry under the order, so the counts below are one higher for each extra one). - A model that answers chat requests. A model that reasons before it answers needs
reasoning_effortset tonone, or it spends the whole output cap on its reasoning and every ask fails. The site's configs set it (inference-backend-configuration.md). The output cap is 400 tokens. Measured by hand on one model, with a trail of 19 entries, the narrative needed about 190 tokens, the status explanation about 25 and the shortage explanation about 90, so the cap is enough for this order and that model. A longer trail or a wordier model can be cut off, and a cut-off answer is a failed ask, not a short one. - Nothing on this page uses retrieval. A question over documents does, and it needs an embedding endpoint beside the chat model. The retrieval gate's bars were measured on one embedding model, so another needs them measured again (retrieval-quality-gate.md).
Run the commands from the repository root, in one shell, after this once:
SITE="${KINDRED_PRACTICE_DIR:-$HOME/.kindred-practice-site}"
export KINDRED_PRACTICE_DIR="$SITE"
trail() {
KINDRED_MANAGEMENT_URL=http://127.0.0.1:18470 \
KINDRED_MANAGEMENT_TOKEN_FILE="$SITE/asking-node.token" \
deployment/kindred_management.sh trail "$1" |
python3 -c 'import json, sys; d = json.load(sys.stdin); print({k: d[k] for k in ("entries_total", "contributing_node_types", "complete", "not_contributed")}); [print(e["node_type"], e["trigger"], e["outcome"]) for e in d["entries"]]'
}
The order, as the site leaves it
- One order,
MD-2027-0301, read by the MES from an invented database, as in mes-as-a-database-log.md. Its record readsblocked, withblocked_reasonquality hold: those are the words the site's mapping gives the blocked status code, and Kindred reports them without deciding them. The material lot it uses isCP-88301. - A block is not a trigger of its own. There is no
order_blockedentry. The MES's log holds a secondorder_releaseentry for the status change, as it does for each row it reads. Those entries carry the id of the queued row and not the order's id, so the order's trail does not show them. - The site's Nodes already ask the model unprompted. The weld reading under the limit makes the MES
triage it (Activity Log trigger
deviation, outcomesucceeded), and a scheduled check on the MES summarises its cases (triggercase_triage_scheduled_check, outcomecase_worthy). That check also drafts a case summary, which waits as a pending sign-off for a person. This page does not review it; Answers the site will not invent does. Nothing you run below is needed to make the model ask for the first time.
Step 1: read the trail
trail MD-2027-0301
{'entries_total': 8, 'contributing_node_types': ['MES'], 'complete': True, 'not_contributed': []}
MES identity_observation new
MES material_consumption_observed complete
MES duplicate_or_late_arriving_event reconciled
MES identity_observation resolved_explicit
MES duplicate_or_late_arriving_event reconciled
MES identity_observation resolved_explicit
MES case_triage_scheduled_check case_worthy
MES duplicate_or_late_arriving_event reconciled
That is the order's trail across the site, and it holds the MES alone. The MES asked ERP and Production Scheduling, and both answered with nothing for this order:
- ERP logged what the MES reported to it, but under a reference to the report
(
erp:report:order_release:MD-2027-0301), not under the order's id. The trail follows the order's id. - Production Scheduling holds the order only inside a schedule record's attributes. Its log names the schedule, never the order.
complete is true because every Node the MES asked answered. It does not mean every Node has
something to say. A Node that answers with nothing is in neither contributing_node_types nor
not_contributed.
Step 2: ask ERP for the order's status
ERP has no route that asks the MES a question, and a second process cannot be the running ERP Node. So this command runs ERP's own order-status task in a second process, built the way the Node builds it from ERP's config, database and certificates. It is practice-only, says so when it runs, and adds no route to the Management API.
deployment/practice_site.sh ask-order-status MD-2027-0301
The output below is one run, made before the prompt for this explanation was changed (see the paragraphs after it). The explanation line is the old prompt's answer. With the prompt the site ships now, the model is told not to mention a shortage here, so your explanation will not read like this one. The status line and the frame around it are what to expect.
Practice-only ask: this is ERP's own task, run in a second process built from ERP's config, database
and certificates. The running ERP Node was not asked; its Activity Log gets the entry it would leave.
order: MD-2027-0301
status: blocked
explanation (written by the model; a draft, not a determination):
The order is currently blocked, which appears to be a result of the previously identified material shortage.
The status, blocked, is what the MES answered. The explanation is one run's output, and a draft. In
this run the model wrote that the block "appears to be a result of the previously identified material
shortage", although no shortage had been recorded: the shortage ask comes after this one. The
explanation joined two things the data does not join. That is why every model-written text here is
labelled a draft, and why the status above it is the part to rely on.
The prompt was changed after this run. Before, it said what to do when a shortage is on file and nothing about when none is, and the model filled the gap. It now says that, with no shortage on file, the model must not mention a shortage, a material or a supply problem, or offer one as a cause. Five calls to the same model with the same data mentioned a shortage once before the change and none after it. Five calls is a small sample, and the text is still a draft, so a model could still say it; if yours never does, that is the change working, not a missing step.
The one case where this explanation does name a shortage is an order that has one on file, which is when
the shortage ask ran first on an order still in-progress (see
If the order is still in progress). Then the prompt tells the model
to work the shortage in as the likely cause.
A status that is plain in-progress or completed prints no explanation, because the task asks no
model for it.
Step 3: read the trail again
trail MD-2027-0301
{'entries_total': 9, 'contributing_node_types': ['MES', 'ERP'], 'complete': True, 'not_contributed': []}
MES identity_observation new
MES material_consumption_observed complete
MES duplicate_or_late_arriving_event reconciled
MES identity_observation resolved_explicit
MES duplicate_or_late_arriving_event reconciled
MES identity_observation resolved_explicit
MES case_triage_scheduled_check case_worthy
MES duplicate_or_late_arriving_event reconciled
ERP order_status_query blocked
ERP now contributes, because its task filed an entry under the order's id (order_id). That is the
entry the ERP Node itself would leave if it asked. The trail is across two Nodes, not three: Production
Scheduling is asked and still has nothing under the order, and a schedule revision is never in the trail
(see Limits).
Step 4: ask for the shortage explanation
The shortage is an argument, not something the site detects: the command takes a material, a quantity and a unit, and asks the MES which orders are in progress on that material.
deployment/practice_site.sh ask-shortage CP-88301 40 --unit kg
Practice-only ask: this is ERP's own task, run in a second process built from ERP's config, database
and certificates. The running ERP Node was not asked; its Activity Log gets the entry it would leave.
material: CP-88301, short by 40.0 kg
in-progress orders found: none
explanation (written by the model; a draft, not a determination):
There are currently no in-progress orders at risk from the shortage of material CP-88301, as there is no active work-in-process (WIP) associated with this material.
It names no order, because the MES names only orders that read in-progress, and this order is
blocked. The task files its entry under the material alone, so the order's trail does not change:
read it again and it still holds nine entries. A shortage names an order only while the order is in
progress, and this site's order is blocked as soon as the MES has read the last row (see
If the order is still in progress).
If the order is still in progress
On one run the order was still in-progress when the shortage ask ran, because the model was cold.
Everything the page says about a blocked order turned round, and the run shows why the sentence above
is about the order's state and not about the material:
- the ask printed
in-progress orders found: MD-2027-0301; - its entry was filed under the order, so the trail gained an
ERPentry with the outcomeexplained; - the narrative that followed said so in its list (
ERP explained an inventory shortage of material CP-88301 and linked it to this order); - and a status ask after that, with inference off, added a line to its fact listing:
Related shortage material: CP-88301.
So the exact texts shown below for inference off are those of a blocked order with no shortage filed
under it. tests/test_practice_site_ask.py pins both cases.
Step 5: have the MES draft a narrative
The MES serves one more route, in its own process, which the site turns on: a drafted narrative of an
order's trail. It is held to the asking Node's token, which carries the correlation scope, and the
site sets at least five seconds between one token's requests so that this page can ask more than once.
curl -s -H "Authorization: Bearer $(cat "$SITE/asking-node.token")" \
http://127.0.0.1:18480/v1/orders/MD-2027-0301/trail/narrative |
python3 -c 'import json, sys; d = json.load(sys.stdin); print({k: d[k] for k in d if k != "narrative"}); print(); print(d["narrative"])'
{'order_id': 'MD-2027-0301', 'subject': 'trail', 'status': 'drafted_for_review', 'label': 'Drafted for a person to review. It is a summary of what this Node and its peers recorded, not a determination.', 'source': 'model', 'fallback': False, 'fallback_reason': None, 'complete': True, 'prompt': {'name': 'order_trail_narrative_drafting', 'version': '0.5.0'}}
**Order Narrative: MD-2027-0301**
**Status Summary**
The record for this order is complete.
**Order Trail & Processing History**
The MES first identified this order as a new entry and subsequently recorded the consumption of material CP-88301. Following several reconciliation events and identity classifications within the MES, the system flagged the order for anomaly narration, determining the case was worthy of review. Finally, an ERP status query confirmed the order is currently blocked due to a quality hold.
- 2026-11-20 23:22:25 UTC: New order record created.
- 2026-11-20 23:22:26 UTC: Material CP-88301 was recorded as consumed by this order; its genealogy is complete.
- 2026-11-20 23:22:26 UTC: Duplicate or late-arriving event merged into the existing order record.
- 2026-11-20 23:22:28 UTC: Incoming event matched the existing order record by its order ID.
- 2026-11-20 23:22:28 UTC: Duplicate or late-arriving event merged into the existing order record.
- 2026-11-20 23:22:31 UTC: Incoming event matched the existing order record by its order ID.
- 2026-11-20 23:22:43 UTC: MES anomaly narration (outcome: case_worthy)
- 2026-11-20 23:22:43 UTC: Duplicate or late-arriving event merged into the existing order record.
- 2026-11-20 23:23:13 UTC: ERP checked this order's status with another node; it came back as blocked.
**Material Genealogy**
The order consumed material CP-88301.
The narrative text is one run's output. What does not depend on the model:
- The label.
statusisdrafted_for_reviewandlabelsays it is a summary of what the Nodes recorded and not a determination. Every answer says so. - The list of entries. The bulleted times are written by code from the trail, row for row, and the model only marks where they go. The model cannot add an entry or drop one.
- What is missing. A trail that lacks a Node's part has a section written by code that names the Node, so the narrative cannot present part of an order as the whole (see below).
complete,sourceandprompt. These come from the trail and the run, not from the model's words.sourcesays whether a model wrote the prose (model), a model wrote it earlier for the same input (cache), or code listed the facts (fallback).
What the model wrote is the prose between those: here it took "quality hold" from the order's
blocked_reason, which is on its record.
The run is one Activity Log entry on the MES, under the order: task type correlation-time explanation,
outcome narrated, draft_status for_review, the prompt's name and version, and the id of the token
that asked (practice-asker), never the token. Nothing approves a narrative. It is a draft that a
person reads, and its entry records who asked and when. A request with no token is 401, and a second
within the interval is 429 with a Retry-After.
Without the model
The same order, asked three ways when the model does not answer. In each, the trail is complete, MES and ERP still contribute, and the Nodes keep running. Each edits both Nodes' configs and restarts the MES, which reads its inference setting when it starts. ERP's asks read ERP's config each time, so they need no restart.
Inference switched off
python3 - <<'EOF'
import json, os, pathlib
site = pathlib.Path(os.environ["KINDRED_PRACTICE_DIR"])
for name in ("mes", "erp"):
path = site / "cfg" / f"{name}.json"
document = json.loads(path.read_text())
document["config"]["inference_enabled"] = False
path.write_text(json.dumps(document, indent=2))
EOF
deployment/practice_site.sh stop mes
deployment/practice_site.sh start mes
deployment/practice_site.sh ask-order-status MD-2027-0301
Practice-only ask: this is ERP's own task, run in a second process built from ERP's config, database
and certificates. The running ERP Node was not asked; its Activity Log gets the entry it would leave.
order: MD-2027-0301
status: blocked
explanation (fixed fact listing, no model asked: inference is off for this Node):
Status: blocked.
Inference disabled for this Node - structured facts only.
deployment/practice_site.sh ask-shortage CP-88301 40 --unit kg
Practice-only ask: this is ERP's own task, run in a second process built from ERP's config, database
and certificates. The running ERP Node was not asked; its Activity Log gets the entry it would leave.
material: CP-88301, short by 40.0 kg
in-progress orders found: none
explanation (fixed fact listing, no model asked: inference is off for this Node):
Shortage: CP-88301 short by 40.0 kg.
Inference disabled for this Node - structured facts only.
No in-progress orders reported for this material.
The status and the shortage correlation are the same as with the model. Only the words differ: code lists the facts instead. The narrative does the same, and says so:
curl -s -H "Authorization: Bearer $(cat "$SITE/asking-node.token")" \
http://127.0.0.1:18480/v1/orders/MD-2027-0301/trail/narrative |
python3 -c 'import json, sys; d = json.load(sys.stdin); print({k: d[k] for k in d if k != "narrative"}); print(); print(d["narrative"])'
{'order_id': 'MD-2027-0301', 'subject': 'trail', 'status': 'drafted_for_review', 'label': 'Drafted for a person to review. It is a summary of what this Node and its peers recorded, not a determination.', 'source': 'fallback', 'fallback': True, 'fallback_reason': 'inference is disabled for this Node, so the facts are listed without a model', 'complete': True, 'prompt': None}
Order trail for MD-2027-0301 (11 activity log entries recorded).
Inference disabled for this Node - structured facts only.
Contributing node types: MES, ERP.
- MES/ingestion-time classification at 2026-11-20T23:22:25.580844+00:00 (outcome: new)
- MES/Material Genealogy Link at 2026-11-20T23:22:26.084234+00:00 (outcome: complete)
- MES/Reconciliation at 2026-11-20T23:22:26.114989+00:00 (outcome: reconciled)
- MES/ingestion-time classification at 2026-11-20T23:22:28.659861+00:00 (outcome: resolved_explicit)
- MES/Reconciliation at 2026-11-20T23:22:28.823737+00:00 (outcome: reconciled)
- MES/ingestion-time classification at 2026-11-20T23:22:31.744202+00:00 (outcome: resolved_explicit)
- MES/anomaly narration at 2026-11-20T23:22:43.758821+00:00 (outcome: case_worthy)
- MES/Reconciliation at 2026-11-20T23:22:43.814971+00:00 (outcome: reconciled)
- ERP/correlation-time explanation at 2026-11-20T23:23:13.298218+00:00 (outcome: blocked)
- MES/correlation-time explanation at 2026-11-20T23:23:28.566177+00:00 (outcome: narrated)
- ERP/correlation-time explanation at 2026-11-20T23:23:57.474424+00:00 (outcome: blocked)
source is fallback, fallback is true, there is no prompt (code wrote it, no prompt did), and the
count in the first line is the number of entries the trail holds at that moment. The trail grows by an
entry for each ask and each narrative, so 11 is this run's count and yours will differ. The completeness
and the entries are the same as with the model for the same trail.
Put the setting back, and restart the MES again, before the next case:
python3 - <<'EOF'
import json, os, pathlib
site = pathlib.Path(os.environ["KINDRED_PRACTICE_DIR"])
for name in ("mes", "erp"):
path = site / "cfg" / f"{name}.json"
document = json.loads(path.read_text())
document["config"].pop("inference_enabled", None)
path.write_text(json.dumps(document, indent=2))
EOF
deployment/practice_site.sh stop mes
deployment/practice_site.sh start mes
An endpoint that refuses the connection
Point both Nodes at an address nothing listens on. The edit keeps the endpoints it replaces in
endpoint-before.json in the site directory, so the last step of this page can put them back. Then
restart the MES and ask again:
python3 - <<'EOF'
import json, os, pathlib
site = pathlib.Path(os.environ["KINDRED_PRACTICE_DIR"])
saved = site / "endpoint-before.json"
before = {}
for name in ("mes", "erp"):
path = site / "cfg" / f"{name}.json"
document = json.loads(path.read_text())
before[name] = document["config"]["inference"]["endpoint"]
document["config"]["inference"]["endpoint"] = "http://127.0.0.1:9"
path.write_text(json.dumps(document, indent=2))
if not saved.exists(): # a second run must not save the refused address as the original
saved.write_text(json.dumps(before))
EOF
deployment/practice_site.sh stop mes
deployment/practice_site.sh start mes
deployment/practice_site.sh ask-order-status MD-2027-0301
The ask gives up in one line on the standard error, ask failed: the model did not answer, so there is no explanation, and exits 1. It prints no explanation and no text from the failure. On the
narrative route the same request is a 502 with the model did not answer; no narrative was drafted:
a text the model did not write is never made up, and the route does not fall back to the fact listing
on its own, because the fallback is for a Node declared to have inference off. A refused connection
fails at once: the run took under two seconds. The shortage ask needs the model for its explanation in
the same way and fails with the same line (a test pins that, and this page did not run it). The Nodes
stayed up and the trail was unchanged.
An endpoint that accepts the connection and never answers
This one was run on a host with a local socket that accepts connections and reads nothing, and with
timeout_seconds set to 5 under inference in both configs. The ask gave up after about 17 seconds
(three tries of five seconds) and exited 1 with the same line. The narrative route answered 502
after about 15 seconds. The Nodes stayed up.
The default timeout_seconds is 120. By the same settings an ask against an endpoint that hangs at the
default would wait up to six minutes before it gives up. That was not run: the figure comes from the
settings, not from a run.
Put the endpoints back from the file the refused case kept, and restart the MES, when you are done:
python3 - <<'EOF'
import json, os, pathlib
site = pathlib.Path(os.environ["KINDRED_PRACTICE_DIR"])
saved = site / "endpoint-before.json"
before = json.loads(saved.read_text())
for name in ("mes", "erp"):
path = site / "cfg" / f"{name}.json"
document = json.loads(path.read_text())
document["config"]["inference"]["endpoint"] = before[name]
path.write_text(json.dumps(document, indent=2))
saved.unlink()
EOF
deployment/practice_site.sh stop mes
deployment/practice_site.sh start mes
When a Node is stopped
deployment/practice_site.sh stop erp
trail MD-2027-0301
deployment/practice_site.sh start erp
trail MD-2027-0301
{'entries_total': 10, 'contributing_node_types': ['MES'], 'complete': False, 'not_contributed': [{'node_type': 'ERP', 'address': '127.0.0.1:18421', 'outcome': 'unreachable', 'reason': 'unreachable at the last rescan'}]}
The trail names the Node it lacks and says it is incomplete. The narrative does the same, in a section
written by code and not by the model (- ERP: unreachable), whatever the model made of its prompt.
After start erp the second trail read was complete again. On this run that was within a second.
Limits
- A schedule revision is not in the trail. Production Scheduling's log names the schedule and never the order, however many times the schedule is revised, so the trail has nothing from it. The trail across the site is across the Nodes that file something under the order's id.
- An order filed under another id looks complete. The trail follows the id it is given. If one Node
files the same order under another id, nothing connects them, and the trail is
completebecause every Node asked answered.completesays that Nodes answered, not that the order is whole. - A failed ask is in no order's trail. The entry a failed task leaves does not carry the order, so an ask that failed is not there to be read.
- A Node that has just restarted can be named missing. The Management API looks for its peers anew on every request, which is why the run above found ERP again at once. A Node's own list of its peers is looked at again on a schedule, every 30 seconds, so a read the Node makes from that list, such as the narrative, can name a peer that has come back for up to 30 seconds. (A Node's own ask of a peer looks again once before it gives up, but no more often than every five seconds, which is a different and shorter wait.) That was run and measured: A Node stopped and started.
- The model's words are a draft. The status explanation in the run above, made before the prompt was changed, joined a block to a shortage the data never recorded. The label, the entries and the incomplete section are the parts code writes.
- A shortage names only in-progress orders, and a block is not one.
- The asks are a second process, not the running Node. They use the Node's own tasks and its own config, database and certificates, and leave the entries the Node would, but the ERP Node does not know they happened.
- The model's name is not checked against the endpoint, and what a Node does with a name the endpoint does not serve was not run.
Where next
Each of these breaks the site on purpose and reads what it says, one question to a page:
- A Node stopped and started: a trail that names who is missing and completes by itself.
- Two Nodes that disagree: a disagreement the trail reports and does not settle, and a record that waits for a person.
- A certificate that fails: a certificate renewed, refused, lost and replaced. Its last case ends the site.
- Answers the site will not invent: a question the documents do not answer, and a draft that stays a draft until a person decides it.
- Tampering with the Activity Log: an edit made by someone who turned the guard off, and what the check reports.
What the test checks
tests/test_late_order_walkthrough_doc.py runs the page's setup and every recipe above in the order
the page gives them, against ERP's own database and config in a bare site directory, a MES answering as
the Node Type does on a loopback listener, the narrative route on a real listener with a real token
file, and a stand-in model that answers fixed words. It pins:
- Completeness. The trail holds the MES alone before the asks, holds MES and ERP after the status ask, and is unchanged by a shortage ask on a blocked order.
- The Node named missing. With ERP's listener stopped, the trail is incomplete, names ERP and nothing else, and the narrative carries the incomplete section naming it.
- The counts the engine computed. The fallback narrative's entry count is the trail's, and its entries are the trail's entries.
- A draft labelled a draft. Every narrative answer carries the status and the label, and the run's
entry carries
draft_statusfor_review. - Who asked. The run's entry carries the id of the token that asked and not the token.
- The fixed texts. With inference off, the two asks print exactly the text shown above.
The test does not pin what a model writes: the stand-in's words are checked only as being the words that reached the output, and the prose above is one real run. It does not run the trail command (it needs a running Management API), and it does not restart a Node.
Release: v0.11.0