Skip to content

Bind the SimpleX channel's wsUrl to the bridge's current address (2026.7.1:6) - #23

Merged
MattDHill merged 1 commit into
Start9-Community:masterfrom
lundog:address-watchers
Aug 11, 2026
Merged

Bind the SimpleX channel's wsUrl to the bridge's current address (2026.7.1:6)#23
MattDHill merged 1 commit into
Start9-Community:masterfrom
lundog:address-watchers

Conversation

@lundog

@lundog lundog commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Problem

openclaw.json holds the bridge's address as a literal. It was resolved once, when Configure SimpleX was submitted, and never revisited — bridgeWsUrl was called from exactly one place and read with .once().

So when the address moved, the channel silently stopped connecting, and the only fix was re-submitting the action. Nothing in the UI explained why.

Fix

main resolves the bridge's ws interface and reconciles openclaw.json before starting the daemon, reading it as a const — so a changed address re-runs main and restarts the service.

The restart is the point, not a cost. Measured on StartOS 0.4.0:

Event Bridge address Result
Bridge stop/start unchanged plugin retries and reconnects; no restart
Bridge Rebuild unchanged same
Bridge reinstall new port main re-runs → restart

Only a reinstall moves the address — and a reinstall also replaces the volume directory behind the file-exchange mounts, which nothing but a restart re-establishes.

I built the no-restart version first (rewrite config, let OpenClaw hot-reload the channel) and rejected it after testing: the channel reconnected in ~19s and looked healthy while file exchange stayed silently broken on the stale mounts. Messaging works, files don't, nothing reports an error — worse than the original bug. A consumer whose integration has no mounts should prefer that form; this one shouldn't.

Two things worth knowing, both verified rather than assumed

The bridge address is not the container's own IP. hostname -I inside the bridge reports a per-instance lease (10.0.3.120) that changes on every stop/start. sdk.host.get with kind: 'bridge' returns the lxcbr0 gateway plus an allocated forwarded port (10.0.3.1:56649) — note it isn't the container's 5225 — and that survives everything except a reinstall. Consumers should resolve the interface, never read the container's address.

Stopping the bridge doesn't make the address unresolvable. The binding record persists while the package is stopped, so const never sees a transient undefined and can't bounce the service. Confirmed by stopping the bridge and watching OpenClaw: only ECONNREFUSED retries on the same port, no restart. That's why no eq guard is needed.

Details

  • applyWsUrl skips the write when the value is unchanged, so an ordinary start doesn't trigger a pointless config hot-reload, and skips it when the value is undefined, so a stopped bridge doesn't blank a working config.
  • Wired through an addressWatchers list in main, mirroring mountIntegrations, so other integrations have an obvious place to go.
  • bridgeWsUrl keeps its .once() signature, so configureSimplex is untouched.

Version

2026.7.1:52026.7.1:6, with a release-note paragraph in all five locales.

Testing

On StartOS 0.4.0, with the SimpleX bridge installed and the channel enabled:

  • bridge stop/start, and Rebuild — address unchanged, no OpenClaw restart, channel reconnected on its own
  • bridge uninstall/reinstall — port changed 6495556649; OpenClaw picked it up, restarted, and reconnected
  • file exchange verified working after the restart (and verified broken without one, on the earlier no-restart build)
  • tsc --noEmit clean, prettier clean, ncc build succeeds

…ent address

openclaw.json held the bridge's address as a literal, resolved once when
Configure SimpleX was submitted and never revisited. When the address moved, the
channel silently stopped connecting and only a re-submit of the action fixed it.

main now resolves the bridge's `ws` interface and reconciles openclaw.json
before starting the daemon, reading it as a `const` so a changed address re-runs
main and restarts the service.

Only a reinstall moves the address, and a reinstall also replaces the volume
directory behind the file-exchange mounts, which nothing but a restart
re-establishes.

Wired through an `addressWatchers` list in main, mirroring `mountIntegrations`,
so other integrations have an obvious place to go.
@MattDHill
MattDHill merged commit 301c996 into Start9-Community:master Aug 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants