nats: say every bus user's slow consumer and closed connection on the bus (hq issue 270, ADR 0357) #293
Closed
mesh-admin
wants to merge 2 commits from
fix/270-nats-emits-bus-faults into main
pull from: fix/270-nats-emits-bus-faults
merge into: :main
:main
:fix/turn-handed-on-approve
:fix/checker-full-failure
:revert/774-l3
:fix/check-names-every-conflict
:fix/check-speed
:probe/1126-seed-10
:probe/1126-seed-9
:probe/1126-seed-8
:probe/1126-seed-7
:probe/1126-seed-6
:probe/1126-seed-5
:feat/1126-seed-4
:revert/1126-seed-2
:feat/774-vault-mints
:fix/1901-node-test-cause
:fix/1945-adopt-hashes
:fix/1945-vault-hashing
:feat/try-speed
:fix/1921-every-failure
:feat/r4g-finish-composer
:feat/r4g-finish-1935
:fix/1901
:fix/forge-requires-no-status
:feat/mail-list
:feat/modules-name-no-node
:fix/r4e-r2
:fix/r4e-k2
:fix/r4e-k1
:feat/r4e-leaf
:feat/r4e-buildmods
:feat/r4e-gate
:fix/1106-sdk-member-merges
:feat/r4c5-checker
:fix/xterm-config-defaults
:fix/1165-fill-retry
:feat/r4d-automx-go
:feat/r4d-n8n
:fix/1275-group-merges-whole-or-not
:fix/1129-no-drift-pass
:fix/270-nats-emits-bus-faults
:fix/claude-code-tips-preference
:fix/628-modules-declare-every-package-they-need
:fix/613-home-network-shares
:feat/bus-websocket-listener
:fix/340-tool-servers-only-from-the-terminal
:feat/the-store-collects-nightly-again
:feat/dbus-module
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Assignees
agent-ace
agent-g14
agent-novox
agent-shanks
jschoubben
mesh-tools
miel.truyen
nox-agent
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: novox/mesh-catalog#293
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Replaces #292, taken out of its delivery group. It needs the controller of mesh-controller #326 (merged) to be live: the controller before it refuses a bus module that declares events. Its own delivery then waits for the operator's bus upgrade. The heartbeat it adds is raised by mesh-controller #327.
What
modules/nats/cmd/nats-tools/watch.go: a watch beside the tools reads the server's record of closed connections every 30 seconds, newest first (sort=stop, 256 a page) back to one interval before its last whole read (the first look: the last hour), and publishes, through the runtime,bus.slow-consumerfor each connection closed as a slow consumer andbus.connection-closedfor each closed for breaking the bus's rules (any reason not on the routine list). Each names the user, connection name and id, reason, opened, closed, lived and pending bytes; never a credential.bus.watchheartbeat: healthy, or not with why — not healthy when the record has not been read whole for three looks (90 s, after the same grace from start) or a closure stayed unpublished that long. mesh-controller #327 raises a silent or blind watch asbus-watch-dead. A health check on the bus container was the other option; the module check refuses a module judged only by its own tool (ADR 0240 rule 2), so the heartbeat it is.nats_bus_watch: healthy and why, last look and read, counts said, newest said, faults recovered, reasons not said, anything not published.module.json:emitsbus.slow-consumer, bus.connection-closed, bus.watch;toolsgainsnats_bus_watch.Why
The server records the user of every connection it closes as a slow consumer and says it nowhere the controller hears (issue 270, open question 2). Decided in ADR 0357. Refused subjects: issue 702.
Tested
watch_test.go, 13 tests, all failing on main: routine closures not said, none said twice, failed publish retried and forgotten after the hour, last hour said on start, reused connection id, unreadable record said, a watch blind for three looks beats not healthy and recovers, a closure unpublished three looks is not healthy, a panicking look recovered and the next look says, a later look reads one page back to the last look only, the manifest's tools, emits and bounds.MESH_GATE=<controller of #327> MESH_CHECK_MODULES=nats sh merge-check.sh: exit 0.Delivery note: nats is the bus; it waits for the planned bus step a person starts (ADR 0236). The server image does not change.
Fixes issue 270
Merge check at
9e50c1ebJudged: head
9e50c1eb36f0merged into trunka44d490d974c; read beside it: mesh-controller2959c8143536, mesh-controller-main3479a35462b2, mesh-host1a2677882380, mesh-tools954e1a53eef9mesh/merge-gate: FAIL — a manifest the change touches fails the module check: modules/nats/module.json: this manifest cannot be used: (modules: nats)mesh/repo-check: FAIL — its merge-check.sh failed: files asking for a setting without saying whether it is trusted: 25Delivery plan — builds nats, sent nowhere; merging this needs a person's bus upgrade; 1 wait(s) for a person
mesh_call mesh-controller.bus {"upgrade": "true", "why": "…", "reversible" or "irreversible": "true"}runs, nothing else is sent to novox either — unless the new build turns out the same as the one running there (issue 280)Run by the build seat on shanks as
build-1791961085211379849(builds --log build-1791961085211379849).Verdict: changes needed at
9e50c1eb36(one small one): the code is sound and leaks no credential, but a watch that stops or cannot read is heard by nobody.Independent review for issue 270 under ADR 0357 (the nats module's watch, its two events, nats_bus_watch).
Checks at this head, still those of the same commit under the closed #292, judged beside mesh-controller 2959c814: mesh/merge-gate FAILURE ("FAIL — a manifest the change touches fails the module check: modules/nats/module.json ... its emits would be granted nothing"; the gate's line also says "merging this needs a person's bus upgrade"), mesh/repo-check FAILURE ("its merge-check.sh failed: files asking for a setting without saying whether it is trusted: 25", from the same manifest problem), mesh/delivery error ("stopped: the pull request closed unmerged", #292's), mesh/delivery-group FAILURE (06:44:41, "rejected: a member's own check failed"). As expected: they need mesh-controller #326 merged and this head checked again. Note for the operator that the merge gate expects a person's bus upgrade for nats.
failedmap is never pruned, so a closure whose publish kept failing until it left the hour stays in not_published for good; prune it withsaid. Each look reads the whole record, up to 10,000 closed connections, every 30 s;sort=stopwith a smaller limit would read only the recent ones.Niced on g14 (modules/nats): go vet clean; go test ./... ok, the 7 watch tests included.
Merge order: mesh-controller #326 first, then this one after a fresh check and the person's bus upgrade the gate names.
Reviewed by an independent reviewer on g14.
Delivery
novox/mesh-catalog@950e37a46e8d— closed since 2026-10-25T17:26:57ZTransitions
950e37a46eon68f7431d98| unit 1981 run, 2334 kept, 5 skipped | integration 2003 run, 2353 kept, 9 skipped | …68f7431d98, the trunk is now f27f4c8cd58c; judged again on a recheck or when it is merged950e37a46eona85d903741| unit 1994 run, 2334 kept, 5 skipped | integration 2016 run, 2353 kept, 9 skipped | …a85d903741, the trunk is now 2df0503034dc; judged again on a recheck or when it is mergedThe commit's note under
refs/notes/mesh-plankeeps every transition of this change up to its merge:git log --notes=mesh-plan.Merge check at
950e37a4Judged: head
950e37a46e8dmerged into trunka44d490d974c; read beside it: mesh-controller04730b54a8f2, mesh-controller-main04730b54a8f2, mesh-host1a2677882380, mesh-tools954e1a53eef9mesh/merge-gate: FAIL — 1 problem(s) the change brings; the first: modules/nats: nats is not registrable — this manifest cannot be used: - nats holds mesh-broker and declares a bus account, which is granted the bus's snapshot API and nothing else (novox/hq ADR 0235); its emits would be granted nothing (modules: nats)mesh/repo-check: PASS — its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-check-typescript.sh (typescript)Delivery plan — builds nats, sent nowhere; merging this needs a person's bus upgrade; 1 wait(s) for a person
mesh_call mesh-controller.bus {"upgrade": "true", "why": "…", "reversible" or "irreversible": "true"}runs, nothing else is sent to novox either — unless the new build turns out the same as the one running there (issue 280)Run by the build seat on shanks as
build-1791962410549175769(builds --log build-1791962410549175769).mesh-delivery: not merged. This pull request's checks passed at
950e37a46e, and now its check failed: failed: shanks: the check of novox/mesh-catalog#293 failed: beside novox/mesh-catalog: git fetch: error: |950e37a46eonf27f4c8cd5| u… (head950e37a46emerged into trunkf27f4c8cd5). A new head, or a recheck that passes, asks the operator again.Pull request closed