OpenClaw / imsg
Merged upstreamCorrectnessMerged Sep 7, 2026

Serialize Messages bridge launches across processes

Added secure cross-process coordination around imsg's complete Messages bridge launch lifecycle, including readiness rechecks, cleanup, spawn, and readiness waiting.

openclaw/imsg · #274

Messaging reliability fix

Concurrent imsg processes now coordinate one Messages bridge launch instead of creating competing instances that can consume requests without returning their responses.

Problem

The existing dispatch queue serialized launch attempts only inside one process. Independent imsg processes could both clean up and start Messages, leaving duplicate injected bridge instances competing for the same request queue and causing outbound responses to disappear.

Approach

Uses a per-container POSIX file lock, provisions its owner-only parent safely, rejects symlinked or shared lock files, and keeps the descriptor close-on-exec. Waiting launchers recheck readiness after acquisition and reuse the running bridge; exceptions and process exit release ownership.

Impact and scope

  • Eliminates a cross-process race that could silently drop outbound messaging responses.
  • Coordinates every production launch entrypoint without transferring lock ownership to the spawned Messages process.
  • Hardens the coordination file against unsafe ownership, permissions, links, and path substitution.

Validation

  • Native macOS trials reproduced duplicate Messages instances in 7 of 15 runs on v0.15.1 and 0 of 15 runs on the exact PR head.
  • A separate-process coordinator harness produced two launch operations on main and one with the fix in 10 of 10 trials; all 18 focused queue and readiness tests passed.
  • Full macOS and Linux CI, build, signing, and lint checks passed; the GitHub-verified merge commit credits Goutam Adwant and closed GH-272.