Cross-context incident runbook: a stuck order
Every context runbook stops at its own boundary. This page follows one order across the three contexts that move it to the dock: order-management (intake, allocation, release), wes-work-planning (work units, release to the floor) and fulfillment-execution (tasks, packages). It tells you which hop to check first and links to the context runbook that owns the fix.
Everything here works on the k3s cluster (nodes k3s-server and
k3s-agent, namespace warehouse-systems, one Kafka broker). Kong, Grafana,
Prometheus and Jaeger are ClusterIP Services, so the localhost URLs below
exist only while warehouse-infra's scripts/k3s-edges.sh runs on your
workstation (it runs kubectl port-forward bound to 127.0.0.1 and re-runs
itself under sudo for port 80):
| What | URL | Service |
|---|---|---|
Kong (every context under /api/<context>) | http://localhost:8000 | kong-kong-proxy in kong |
| Grafana | http://localhost:3000 | grafana in observability |
| Prometheus | http://localhost:9090 | prometheus-server in observability |
| Jaeger | http://localhost:16686 | jaeger in observability |
| Alertmanager | not forwarded by the script: kubectl -n observability port-forward svc/prometheus-alertmanager 9093:9093 | prometheus-alertmanager in observability |
The Kafka broker is the pod kafka-controller-0 (container kafka) in
warehouse-systems: one combined controller and broker, so a restart or an
out-of-memory kill of that pod stops every context's events at once. Kafka has
no host-reachable listener, so every Kafka command here runs inside that pod.
The path an order takes
Identifiers you carry from hop to hop:
| Hop | Key | Where it comes from |
|---|---|---|
| order-management | order id | POST /orders response |
| wes-work-planning | work unit <orderId>-line-<lineNo>, reference = order id | ApplyOrderAllocated (one work unit per allocated line) |
| fulfillment-execution | task orderRef = the work unit id <orderId>-line-<lineNo> | ConsumeWorkReleased; Pack tasks fulfillment-execution creates itself carry the order id |
Every hop goes through a transactional outbox and a Kafka topic, so a stuck order is almost always one of four things: the producer's outbox is not draining, the consumer is not reading, the consumer dead-lettered the message, or the next step waits for a person or a station.
1. Start from the alerts
Open Prometheus /alerts on http://localhost:9090 (or the ALERTS series
in Grafana), or Alertmanager's /api/v2/alerts after the port-forward above,
and filter on the three contexts. Alertmanager's only receiver is null:
nothing pages anyone, so an alert exists only where you look at it. The alert catalogue lists every
rule.
| Firing alert | Likely hop | Go to |
|---|---|---|
WarehouseOutboxLagHigh for order-management | allocated orders are not reaching Kafka | step 3 |
WarehouseOutboxLagHigh for wes-work-planning | released work is not reaching Kafka | step 5 |
WarehouseKong5xxRatioHigh for one of the three | the API itself fails (often a dependency: inventory-storage behind the order-management breaker, Postgres) | that context's troubleshooting page |
WarehousePodRestarting for one of the three | a binary exits on purpose (projector consumer stopped, boot retry exhausted, migration failed) or is OOM-killed | kubectl -n warehouse-systems logs --previous on the pod, then the context runbook |
| nothing fires | consumer lag, a dead-lettered message, or work that waits for a release or a station | follow steps 2 to 7 in order |
fulfillment-execution exports no outbox-lag gauge and no context exports consumer lag, so a stuck order can be silent. Steps 2 to 7 do not depend on an alert.
2. order-management: what state is the order in?
curl -s http://localhost:8000/api/order-management/orders/<orderId>
| Order / line status | Meaning | Next |
|---|---|---|
Received, lines Pending | allocation never happened (permissive inventory client, or a hard failure at intake) | order-management troubleshooting: cancel and resubmit with a new Idempotency-Key |
Backordered lines | inventory-storage answered 409 (no usable stock): a business fact | POST /orders/<orderId>/allocation-retries once stock exists |
Allocated / PartiallyAllocated, not released | held at intake (ship-complete rule or network hold) | POST /orders/<orderId>/releases when the hold reason is gone |
Released / PartiallyReleased | order-management is done; the order is in wes-work-planning's hands | step 3 |
Cancelled | nothing downstream should happen | none |
3. order-management: did the event leave?
Released lines are announced through the outbox
(OrderAllocated / OrderPartiallyAllocated on
warehouse.order-management.events). In order-management's database:
SELECT id, topic, event_type, key, attempts, last_error, created_at
FROM outbox_events
WHERE published_at IS NULL
ORDER BY id
LIMIT 20;
- Rows with a growing
attemptsand alast_error: Kafka is unreachable or one row fails every pass. Fix the cause inlast_error; the relay resumes on its own. - A row with
attempts >= 20(OUTBOX_MAX_ATTEMPTS, default 20): the relay parked it and loggedoutbox relay: row reached the attempt cap and is no longer claimedat ERROR. Later rows, even for the same order, have overtaken it. Fix the cause, then re-arm it withUPDATE outbox_events SET attempts = 0 WHERE id = <id>;(order-management runbook). - No unpublished row for the order: the event left. Go to step 4.
Since the gap-fix wave (D27) the outbox row stores the request's W3C trace
context and the relay sends it as Kafka headers, so a consumer that
extracts it continues the trace of the POST /orders call. Search Jaeger
(http://localhost:16686) for the order-management trace first; when it
ends at the relay, the event was not consumed yet.
4. wes-work-planning: did it read the order?
curl -s "http://localhost:8000/api/wes-work-planning/work-units?reference=<orderId>"
An empty array means no work unit exists for the order. Check, in order:
-
Consumer lag of the integration consumer group (default
wes-work-planning):kubectl -n warehouse-systems exec kafka-controller-0 -c kafka -- \bash -c 'env KAFKA_HEAP_OPTS=-Xmx128m kafka-consumer-groups.sh \--bootstrap-server localhost:9092 --describe --group wes-work-planning'Keep the
KAFKA_HEAP_OPTS=-Xmx128mprefix: the CLI shares the broker container's memory limit, its full-heap default has OOM-killed the single broker before, and that stops every consumer (warehouse-infradocs/dlq-runbook.md, "Broker access").Lag on
warehouse.order-management.eventswith no progress means the consumer stopped. The loop exits on purpose when a DLQ publish or an offset commit fails (logkafka consumer stopped); nothing is lost, restart the pod after fixing the broker. -
Dead letters on
warehouse.order-management.events.dlq: the handler failed 3 times. The usual cause is a line whosepath_idis not in the process-path catalogue (the whole event fails). Read thex-dlq-errorheader, declare the path in process-path-management, then replay the message. -
processed_eventsalready holds the CloudEventsid: the event was applied and every line was a duplicate. Look the work unit up by id instead:GET /work-units/<orderId>-line-<lineNo>.
5. wes-work-planning: was the work released, and did WorkReleased leave?
Each work unit has a state: Pending → Released → Completed.
Pending: nothing releases it on its own. Work is released by a call toPOST /paths/<pathId>/work-releases(REST, the MCP toolrelease_next_work, or the console), earliest CPT first. The call answers409 wip-limit-reachedwhen the path is at its WIP limit: that happens when completions from fulfillment-execution stop arriving (step 7), because onlyRecordCompletionfrees a slot. Check the path withGET /paths/<pathId>/telemetry.Released:WorkReleasedwent into wes-work-planning's outbox. Run the sameoutbox_eventsquery as in step 3 against wes-work-planning's database, and re-arm a parked row the same way (wes-work-planning runbook).wes_outbox_lag_secondson thewarehouse-wes-work-planningdashboard shows the same thing as a gauge.
6. fulfillment-execution: did it create the task?
curl -s "http://localhost:8000/api/fulfillment-execution/tasks?orderRef=<orderId>-line-<lineNo>"
An empty array means WorkReleased never became a task. The
fulfillment-execution troubleshooting page
has the full decision tree; the common causes are:
- A new consumer group (
WORK_RELEASED_CONSUMER_GROUP, defaultfulfillment-execution) starts at the latest offset: events released before the group existed are never read. Re-release the work. - Unknown
path_idin fulfillment-execution's catalogue: 3 attempts, thenwarehouse.work-planning.events.dlq. Define the path, then replay. - Not ready yet: with
PATH_CATALOGUE_SOURCE=kafkathe HTTP listener starts before the catalogue replay and/readyzanswers503until the replay has caught up (ADR 0044).
Check the group the same way as in step 4 with
--group fulfillment-execution.
7. fulfillment-execution: is the task moving?
| Task state | Meaning | Next |
|---|---|---|
PENDING | no station has pulled it | stations must call POST /stations/<stationId>/task-claims; GET /queues/<taskType>/depth shows the backlog. Too few stations with the required capability, or none checked in |
CLAIMED | a station holds the lease | an expired lease goes back to PENDING on the next lease-expiry sweep (POST /task-lease-expirations, called every minute by the fulfillment-execution-expire-leases CronJob in warehouse-systems) |
COMPLETED | TaskCompleted went into the outbox | check fulfillment-execution's outbox_events as in step 3; this context has no outbox-lag gauge, so the SQL query and the log line outbox relay pass failed are the only signals |
When TaskCompleted is published, wes-work-planning applies it and marks
the work unit Completed (which frees the WIP slot), and order-management
uses PackageManifested and TaskCPTMissed from the same topic to
re-promise. A work unit stuck in Released while its task is COMPLETED
means wes-work-planning is not consuming warehouse.fulfillment.events:
check its consumer group (step 4) or complete the unit by hand with
POST /work-units/<id>/completions.
8. After the incident
- Re-armed outbox rows publish out of order relative to rows with the same
key that overtook them. Consumers dedupe on the CloudEvents
id, but a state-carrying consumer may need the context's own read-model rebuild procedure (see each runbook). - A DLQ message is never retried by itself. Replay it only after the cause is fixed, or it lands in the DLQ again.
- Record what happened against the Fleet SLOs: a stuck outbox row or a stopped consumer is an event-delivery SLO breach even when no HTTP call failed.