Skip to content

Persist manual nodes in the broker - #32

Merged
JaredP94 merged 2 commits into
mainfrom
fix/broker-manual-nodes
Nov 2, 2026
Merged

JaredP94 merged 2 commits into
mainfrom
fix/broker-manual-nodes

Conversation

@JaredP94

@JaredP94 JaredP94 commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Description

nvpair-manual-nodes keeps entries in memory and the desktop owned the only durable copy, replaying it once the broker came up. A manual-nodes worker restarted by the broker (crash or hang) — or any broker driven by nvpair-tui — lost every manual node, including Tailscale/VPN peers reachable no other way.

The broker now persists successful node/add / node/remove to configs/manual-nodes.json (the file the desktop already wrote, so existing entries carry over) and replays it into every new manual-nodes worker. The desktop's store and replay are removed — one owner, in the service.

Ported from NVIDIA/Personal-AI-Router@aed93b6 (NVIDIA#60), merged with this fork's scheduling-demand push on worker start.

Validation

  • go test ./... in nvpair-ui-broker, including upstream's persistence tests.
  • services/tests broker management/supervision tests run with an isolated HOME; my real manual-nodes.json was verified untouched. (Two manual-bridge tests there fail identically on main — pre-existing.)
  • Desktop typecheck, lint, test:unit, dead-code:check, service-contracts:check.

Risk

The on-disk format is the one the desktop already used. ui-broker 2.4.1 → 2.5.0.

Checklist

  • I have read the Contributing Guidelines.
  • Every commit is signed off (git commit -s), certifying the Developer Certificate of Origin.
  • New or existing tests cover the change.
  • Relevant documentation is updated.
  • I checked the diff, changed filenames, and commit messages for credentials, private data, internal URLs, internal issue identifiers, and generated artifacts.
  • I recorded the validation commands and results above.
  • I bumped any affected component in services/versions.json, and described user-visible changes above so they reach the release notes.

Part of the upstream issue/PR review. Each branch is independent off main; they all bump services/versions.json, so the second one merged will need a trivial conflict resolution there.

JaredP94 and others added 2 commits November 2, 2026 20:50
nvpair-manual-nodes keeps its entries in memory, and the desktop app
owned the only durable copy, replaying it after the broker came up. A
manual-nodes worker restarted by the broker (after a crash or a hang),
or a broker driven by the terminal interface, lost every manual node,
including the Tailscale and VPN peers that are reachable no other way.

The broker now persists successful node/add and node/remove operations
to configs/manual-nodes.json in the per-user data directory, the file
the desktop already wrote, and replays the entries into every new
manual-nodes worker. The desktop's own store and replay are removed:
one owner, in the service.

Ported from NVIDIA/Personal-AI-Router@aed93b6 (NVIDIA#60), adapted to this
fork's broker.

(cherry picked from commit aed93b6)
Co-authored-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
Signed-off-by: Jared Ping <13906915+JaredP94@users.noreply.github.com>
A node/add or node/remove held the mutation lock until the manual-nodes
worker answered, and took it on the broker's request loop. A second
mutation while the first was unanswered (a hung worker) blocked every
broker request, including restart and shutdown, until the worker was
restarted.

Each mutation now runs in its own goroutine chained behind the previous
one, so mutations still apply in the order clients sent them and the
request loop never waits. Adds a test for that case and one for loading
the file the desktop store used to write.

Signed-off-by: Jared Ping <13906915+JaredP94@users.noreply.github.com>
@JaredP94
JaredP94 force-pushed the fix/broker-manual-nodes branch from 0a3d286 to 1a7ee9a Compare November 2, 2026 18:51
@JaredP94
JaredP94 merged commit 6f8e205 into main Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant