This document captures the root-cause diagnosis, historical context, test topology, and proposed architectural solutions for the Discovery Tests CI failure on the flaky branch (PR #1451, commit 66d76fec5, GitHub Actions run 39536049757 / job 119013686490).
It is written as a self-contained briefing for a future agent session (@FIX_DISCOVERY.md). Remember to audit GEMINI.md and AGENTS.md before implementing and verifying changes.
On commit 66d76fec5, 30 of 31 CI checks passed; only Discovery Tests failed during the E2E Tests step (misc/discoverynode/testing/e2e/test_local site_model).
.github/workflows/testing.yml(Start UDMIS container, lines 534–576) launches theudmisDocker container withbin/udmi startas PID 1:docker run -d --net udminet --name udmis -p 8883:8883 -p 18836:5432 \ -v $PWD/site_model:/root/site_model \ -v $PWD/var/tmp:/tmp \ -v $PWD/var/etcd:/root/udmi/var/etcd \ -v $PWD/var/mosquitto:/etc/mosquitto \ -v $PWD/out:/root/udmi/out \ udmis udmi/bin/udmi start block site_model //mqtt/localhost:8883
- Phase 1 inside the container (
bin/tmux_barbican) succeeds:- Starts
etcd,mosquitto, andudmisinside theudmi_barbicantmux session. udmisinitializes and writes/tmp/pod_ready.txt(mounted tovar/tmp/pod_ready.txton the host).- The CI loop in
Start UDMIS containerseesvar/tmp/pod_ready.txton the host and exits0immediately.
- Starts
- Phase 2 inside the container (
bin/tmux_butler) fails and kills PID 1:- Immediately after
tmux_barbicanreturns,bin/udmirunsbin/tmux_butler start site_model //mqtt/localhost:8883. tmux_butlerspawns tmux windows forpostgres,influxdb,butler, andregistrar:influxdbwindow fails:udmis/Dockerfile.udmisdoes not installinfluxd, sobin/start_influxexits with code 1 (Unable to find influxd binary in /usr/bin, /usr/local/bin, or /tmp/influxdb).registrarwindow fails:bin/registrarinvokesvalidator/bin/registrar->bin/toolrun registrar com.google.daq.mqtt.util.Dispatcher .... Becauseudmis/Dockerfile.udmisdoes not packagevalidator/orvalidator/build/libs/validator-1.0-SNAPSHOT-all.jar,toolrunattempts to runvalidator/bin/build, fails, andjavacrashes:Building validator/build/libs/validator-1.0-SNAPSHOT-all.jar... ./bin/registrar: line 15: validator/bin/build: No such file or directory Running tools version 1.5.2-403-g66d76fec5 Error: Could not find or load main class com.google.daq.mqtt.util.Dispatcher Caused by: java.lang.ClassNotFoundException: com.google.daq.mqtt.util.Dispatcher === [registrar] exited with code 1 ===
bin/tmux_butler(lines 75–96) detects=== [registrar] exited with code 1 ===and callsfail "Initial registrar run in 'udmi_butler' failed.".- Because
bin/udmiruns with#!/bin/bash -eas PID 1 of the container,bin/udmiexits with code 1 before reachingtail -f /dev/nullon line 304, terminating the entireudmiscontainer.
- Immediately after
- The
E2E Testsstep (misc/discoverynode/testing/e2e/test_local site_model) fails on the host:docker exec udmis psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "TRUNCATE TABLE udmi_messages;"fails with:Error response from daemon: container ... is not runningbin/registrarandbin/mapperon the host fail to connect to Mosquitto (127.0.0.1:8883) and PostgreSQL (127.0.0.1:18836) withConnectionRefusedError: [Errno 111] Connection refused.- All 3
pytesttests inmisc/discoverynode/testing/e2e/test_local.pyfail.
The Discovery Tests CI job (.github/workflows/testing.yml:497-598) tests misc/discoverynode (the Python edge agent / "Spotter" that scans BACnet, Ethernet/nmap, passive IPv4, and vendor networks and publishes UDMI discovery events).
- Unit Tests (
misc/discoverynode/testing/unit/unit_tests.sh): Runs isolatedpytestunit tests inside thetest-discovery_nodecontainer. - Integration Tests (
misc/discoverynode/testing/integration/integration_test.sh&misc/discoverynode/src/tests/test_integration.py): Spins up a Docker network (discovery-integration,192.168.12.0/24) with a simulated BACnet device container (test-bacnet-deviceat192.168.12.1) and runstest-discovery_nodewith a mocked MQTT client to verify real BACnet UDP broadcast discovery (Who-Is/I-Am,refs) andnmapSSH discovery (OpenSSH). - E2E Tests (
misc/discoverynode/testing/e2e/test_local&test_local.py): Tests the full end-to-end closed-loop UDMI discovery and mapping workflow across 3pytestcases:test_discovered_proxied_devices_are_created(discovers and maps 9 BACnet devices behindGAT-1)test_discovered_devices_are_created(discovers and maps 6 BACnet devices behindAHU-1)test_sequencer(runsbin/sequencer -v site_model //mqtt/localhost GAT-1 scan_single_future)
┌────────────────────────────────────────────────────────────────────────────┐
│ CI Host (ubuntu-24.04) │
│ - Runs pytest (`misc/discoverynode/testing/e2e/test_local.py`) │
│ - Runs `bin/registrar`, `bin/mapper`, `bin/sequencer` against: │
│ • MQTT: localhost:8883 (forwarded to udmis container :8883) │
│ • PostgreSQL: localhost:18836 (forwarded to udmis container :5432) │
└───────────────┬────────────────────────────────────────┬───────────────────┘
│ -p 8883:8883 │
│ -p 18836:5432 │
▼ ▼
┌──────────────────────────────────────┐ ┌─────────────────────────────────┐
│ Docker net: `udminet` │ │ Docker net: │
│ (192.168.99.0/24) │ │ `discoverynode-network` │
│ │ │ (192.168.11.0/24) │
│ ┌────────────────────────────────┐ │ │ │
│ │ Container: `udmis` │ │ │ ┌───────────────────────────┐ │
│ │ (192.168.99.2) │ │ │ │ `discoverynode-test- │ │
│ │ - mosquitto (:8883) │ │ │ │ device1..9` │ │
│ │ - etcd (:2379) │ │ │ │ (192.168.11.1..9, │ │
│ │ - udmis Java pod │ │ │ │ BACnet IDs 3001..3009) │ │
│ │ - postgres (:5432) │ │ │ └─────────────▲─────────────┘ │
│ │ - butler daemon │ │ │ │ BACnet UDP │
│ └───────────────▲────────────────┘ │ │ ▼ │
│ │ MQTT (:8883) │ │ ┌───────────────────────────┐ │
│ └───────────────────┼───┼──┤ `discoverynode-test-node` │ │
│ (dual-homed) │ │ │ (192.168.11.251) │ │
└──────────────────────────────────────┘ └──┴───────────────────────────┴──┘
test_local.pygenerates a site model on the host (site_model/devices/GAT-1) and runsbin/registraron the host to registerGAT-1into Mosquitto/etcd (localhost:8883).test_local.pystartsdiscoverynode-test-device1..9ondiscoverynode-networkanddiscoverynode-test-nodeon bothdiscoverynode-networkandudminet(configured to connect to MQTT at192.168.99.2:8883).test_local.pyrunsbin/mapper site_model //mqtt/localhost GAT-1 discoveron the host, publishing a discovery scan config toGAT-1.discoverynode-test-nodereceives the config over MQTT, runs a BACnet scan on192.168.11.0/24, discovers the BACnet device containers, and publishesdiscoveryevents to Mosquitto (192.168.99.2:8883).udmisreflects those messages to the/udmiMQTT feed (rocket:monkey), where thebutlerdaemon (bin/start_butler) ingests them into PostgreSQL (udmi_messages/udmi_discoverytables).test_local.pyrunsbin/mapper site_model //mqtt/localhost GAT-1 map bacneton the host, which queries PostgreSQL (POSTGRES_PORT=18836) and writes discovered device models, followed bybin/registraron the host, which populatessite_model/extras/00001..00009.
- Before PR #1422:
The
udmiscontainer was a "Barbican-in-a-box" appliance (etcd,mosquitto,udmis) started withudmi/bin/start_local block site_model/cloud_iot_config.json. - PR #1422 (
88249286e, "Updating mapping flow to new UUFI python utility"): Replaced the JavaMappingAgentwith Pythonbin/mapper(butler/bin/butler). Becausebin/mapper ... mapqueries PostgreSQL (udmi_messages) instead of listening to MQTT directly, PostgreSQL was added inside theudmiscontainer and port-forwarded to the host (-p 18836:5432in.github/workflows/testing.yml,POSTGRES_PORT: 18836inE2E Tests, anddocker exec udmis psql ... TRUNCATE TABLE udmi_messages;intest_local.py:379). - PR #1425 (
6d35b7541, "Migrate database capture code to butler, in python"): RemovedCaptureProcessor.javafromUdmiServicePodand replaced it with the Pythonbutleringestion daemon (bin/start_butler). To keep theudmiscontainer self-contained forDiscovery Tests(andbridgehead),butler/,common/,gencode/, andschema/were added toudmis/Dockerfile.udmisandudmis/bin/build, andbin/start_butlerwas added tobin/start_local(andbridgehead/udmis/startup/udmis_startup.sh). - PR #1427 (
c5ed8f302, "Updates to the tmux process control model"): Replacedbin/start_localwithbin/udmi start, which splits local services into two tmux sessions (documented inARCHITECTURE.md):- Barbican (
bin/tmux_barbican):etcd,mosquitto,udmis,pubsub - Butler (
bin/tmux_butler):postgres,influxdb,butler,registrar,validatorBecausebin/udmi startlaunches bothtmux_barbicanandtmux_butlerby default, switching theudmiscontainer command inDiscovery Testsfrombin/start_localtoudmi/bin/udmi start block site_model //mqtt/localhost:8883caused theudmiscontainer to runtmux_butleras well.
- Barbican (
- Current
flakyBranch (4e7f1be3d&66d76fec5):registrarbecame default-enabled inbin/tmux_butlerwith synchronous exit-status verification (etc/tmux_common.sh+bin/tmux_butler). Becauseudmis/Dockerfile.udmisdoes not containvalidator/build/libs/validator-1.0-SNAPSHOT-all.jar,tmux_butlernow fails deterministically inside theudmiscontainer.
There are two main architectural approaches to resolve this cleanly. Discuss with the user or select the approach that aligns with their preferred container boundary before editing.
Make the udmis container run only Barbican (etcd, mosquitto, udmis), matching ARCHITECTURE.md, and run tmux_butler on the CI host in Discovery Tests.
- Why this makes architectural sense:
- In
ARCHITECTURE.md,udmisbelongs to Barbican (bin/tmux_barbican), whilepostgres,influxdb,butler,registrar, andvalidatorbelong to Butler (bin/tmux_butler). udmis/Dockerfile.udmisdoes not havevalidator-1.0-SNAPSHOT-all.jar(needed byregistrarandvalidator) orinfluxd(needed byinfluxdb).- On the CI host in
Discovery Tests,sudo bin/setup_baseandudmi-prebuilt-packagesare already installed, andtest_local.pyalready runsbin/registrar,bin/mapper(butler), andbin/sequenceron the host.
- In
- What changes under Option 1:
- Container startup command:
Have the
udmiscontainer run only Barbican—either by invokingudmi/bin/tmux_barbicanor by scopingbin/udmi startinside the container (e.g.,udmi/bin/udmi start block site_model //mqtt/localhost:8883 +mosquitto +etcd +udmis, or havingbin/udmiskiptmux_butlerwhen running inside theudmiscontainer / withoutvalidator). (Check.github/workflows/testing.yml:543,docs/udmis/local_docker.md:34, andudmis/bin/actualize:14.) - Host Butler startup in
.github/workflows/testing.yml(Discovery Tests):- Remove
-p 18836:5432fromdocker run ... --name udmis(.github/workflows/testing.yml:537) and removePOSTGRES_PORT: 18836fromE2E Tests(.github/workflows/testing.yml:585). - Start
tmux_butleron the host after theudmiscontainer is ready (e.g.,bin/tmux_butler start site_model //mqtt/localhost:8883 !registraror after generating initial certs, sincetest_local.pywipes and recreatessite_model/devicesin itsnew_site_modelfixture).
- Remove
misc/discoverynode/testing/e2e/test_local.py:379: Change:to runrun("docker exec udmis psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c \"TRUNCATE TABLE udmi_messages;\"")
psqldirectly against the host PostgreSQL instance:run("psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c \"TRUNCATE TABLE udmi_messages;\"")
- Caveat for
bridgehead:bridgehead/udmis/DockerfilebuildsFROM ${UDMIS_BASE_IMAGE}(udmis:latest) andbridgehead/udmis/startup/udmis_startup.sh:92explicitly runs$UDMI_ROOT/bin/start_butler "$site_model" "$project_spec"(talking to separatepostgresandinfluxdbcontainers inbridgehead/docker-compose.yml). Therefore, keep theADD build/butler/ udmi/butler/(andcommon,gencode,schema) lines inudmis/Dockerfile.udmiseven iftmux_butleris not run inside the standaloneudmiscontainer.
- Container startup command:
Have the
If the standalone udmis container is intended to remain a self-contained appliance for mosquitto + etcd + udmis + postgres + butler without requiring validator or influxd inside the image:
- What changes under Option 2:
- Exclude
registrarandinfluxdbwhen startingbin/udmiin theudmiscontainer:- In
.github/workflows/testing.yml:543,docs/udmis/local_docker.md:34, andudmis/bin/actualize:14:udmis udmi/bin/udmi start block site_model //mqtt/localhost:8883 !registrar !influxdb
- Or in
bin/udmi/bin/tmux_butler, do not default-enableregistrar(orinfluxdb) when running inside theudmiscontainer environment wherevalidator/influxdare not installed (though rememberAGENTS.md: "Fail Fast and No Silent Fallbacks" — explicit service filters!registrar !influxdbare cleaner than silent environment sniffing).
- In
- No changes needed to
-p 18836:5432,POSTGRES_PORT: 18836, ortest_local.py:379, becausepostgresandbutlercontinue running inside theudmiscontainer andtest_local.pyalready runsbin/registraron the host before each test.
- Exclude
| File | Lines | Role |
|---|---|---|
.github/workflows/testing.yml |
497–598 |
Discovery Tests CI job definition (Build UDMIS container, Start UDMIS container, E2E Tests) |
bin/udmi |
214–304 |
Orchestrates bin/tmux_barbican and bin/tmux_butler, waits for POD_READY, then blocks if block is passed |
bin/tmux_barbican |
1–102 |
Starts etcd, mosquitto, udmis, and optional pubsub |
bin/tmux_butler |
1–109 |
Starts postgres, influxdb, butler, registrar, and optional validator; waits synchronously for registrar exit 0 |
etc/tmux_common.sh |
195–218 |
tmux_init_or_add_window wrapper that logs === [<win_name>] exited with code $ec === |
udmis/Dockerfile.udmis |
1–39 |
Builds the udmis image (has udmis JAR, butler/, postgresql, mosquitto, tmux; does not have validator JAR or influxd) |
udmis/bin/build |
45–54 |
Mirrors bin/, etc/, schema/, butler/, common/, gencode/, mcp/ into udmis/build/ |
misc/discoverynode/testing/e2e/test_local |
1–25 |
Wrapper script invoked by Discovery Tests (E2E Tests step) |
misc/discoverynode/testing/e2e/test_local.py |
234–380 |
pytest E2E tests (test_discovered_proxied_devices_are_created, test_discovered_devices_are_created, test_sequencer, and new_site_model fixture with docker exec udmis psql ...) |
bridgehead/udmis/startup/udmis_startup.sh |
91–92 |
Starts bin/start_butler inside Bridgehead's udmis container |
docs/udmis/local_docker.md |
29–35 |
Documentation for running the udmis container locally |
udmis/bin/actualize |
9–15 |
Helper script to bootstrap the udmis container |