Skip to content

fix(gateway): suppress Windows console flicker and prevent Bonjour fatal crashes (#70238, #72344, #72339)#72332

Closed
PratikRai0101 wants to merge 1 commit into
openclaw:mainfrom
PratikRai0101:fix/windows-gateway-bonjour-flicker
Closed

fix(gateway): suppress Windows console flicker and prevent Bonjour fatal crashes (#70238, #72344, #72339)#72332
PratikRai0101 wants to merge 1 commit into
openclaw:mainfrom
PratikRai0101:fix/windows-gateway-bonjour-flicker

Conversation

@PratikRai0101

@PratikRai0101 PratikRai0101 commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

fix(gateway): suppress Windows console flicker and prevent Bonjour fatal crashes (#70238, #72344, #72339)

Summary

  • Problem: On Windows, launching the gateway causes jarring command prompt flickers. More critically, on both Linux and Windows, the Bonjour plugin causes fatal gateway crashes due to unhandled CIAO PROBING CANCELLED rejections and hard process.exit(1) calls in the @homebridge/ciao dependency when mDNS conflicts (like Avahi) occur.
  • Why it matters: This range of issues makes the gateway appear unstable on Windows and entirely unusable on many headless Linux VPS environments where mDNS stacks often conflict.
  • What changed: - Windows Flicker Fix: Added windowsHide: true to the TUI spawn and patched 6 exec calls within @homebridge/ciao.
    • Plugin Shielding: Updated advertiser.ts with error helpers to catch and suppress CANCELLED errors, logging them as debug instead of allowing them to crash the process.
    • Dependency Hardening: Patched @homebridge/ciao@1.3.6 to replace process.exit(1) with console.warn() in CiaoService.js and Responder.js recovery paths.
    • Conflict Resilience: Added detection for EADDRINUSE. If a conflict (e.g., Avahi) is detected, the plugin now logs a warning and disables itself gracefully rather than crashing the core service.
  • What did NOT change: No changes were made to core networking logic or discovery protocols.

Change Type

  • Bug fix
  • Security hardening (Stability)
  • Refactor required for the fix (Dependency patch)

Scope

  • Gateway / orchestration
  • Integrations (Bonjour/mDNS)
  • UI / DX

Linked Issues


Root Cause

  1. Visual Flicker: Missing windowsHide flags on child process spawns in both internal code and dependencies.
  2. Fatal Crashes: Probing cancellations from ciao were leaking as unhandled promise rejections during watchdog restarts.
  3. Hard Exits: The @homebridge/ciao library utilized process.exit(1) for internal network interface update failures, which is inappropriate for a plugin-level dependency.

User-visible / Behavior Changes

  • Windows: Silent startup without flashing cmd.exe windows.
  • Linux: Resilience against existing Avahi/mDNS stacks; the gateway logs a conflict warning and continues to run.
  • General: Improved reliability; Bonjour failures are no longer fatal to the core gateway process.

Repro + Verification

Environment

  • OS: Windows 11 / Ubuntu 24.04 (Headless VPS)
  • Runtime: Node v22+
  • Tooling: pnpm

Steps

  1. Start gateway on Windows -> Verified: No visible console flickers.
  2. Start gateway on Linux with avahi-daemon active -> Verified: Logs mDNS conflict detected, gateway remains stable.
  3. Trigger watchdog re-advertise cycle -> Verified: CANCELLED errors caught, process stays alive.

Evidence

  • All 29 bonjour extension tests pass.
  • Verified pnpm patch-commit for @homebridge/ciao@1.3.6 contains both visibility flags and exit-trap removals.
  • Confidence Score: 5/5 (Greptile)

Human Verification

  • Verified scenarios: Local Windows 11 build; Headless Linux VPS (Contabo) with Avahi conflict.
  • Edge cases checked: Relaunching the gateway multiple times; manual watchdog triggers.

@greptile-apps

greptile-apps Bot commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR addresses Windows console flicker and fatal Bonjour/mDNS crash scenarios by adding windowsHide: true to child-process spawns, patching @homebridge/ciao to replace process.exit(1) with console.warn(), and extending advertiser.ts with graceful CANCELLED-error suppression and EADDRINUSE-triggered self-disable logic.

The implementation is well-structured: isCancellationError and isEaddrInUse helpers are correct (both normalise case before searching), disableAdvertiser is correctly extracted and reused for both the EADDRINUSE path and the MAX_CONSECUTIVE_RESTARTS path, and the stop() wrapper in a try/catch is a sound improvement.

Confidence Score: 5/5

Safe to merge — no P0 or P1 issues found; changes are targeted, internally consistent, and well-guarded.

All new code paths are correct: case-normalisation in isEaddrInUse and isCancellationError is consistent, disableAdvertiser idempotency is enforced by the disabled flag, void usage in .catch() and sync catch blocks is intentional, and the @homebridge/ciao patch safely replaces fatal process.exit(1) calls. No logic inversions, data-loss paths, or security concerns were identified.

No files require special attention.

Reviews (4): Last reviewed commit: "Merge branch 'main' into fix/windows-gat..." | Re-trigger Greptile

Comment thread package.json Outdated
Comment thread src/canvas-host/a2ui/.bundle.hash Outdated
@PratikRai0101 PratikRai0101 force-pushed the fix/windows-gateway-bonjour-flicker branch 3 times, most recently from 86dcdc9 to c1fbe47 Compare April 26, 2026 20:31
@openclaw-barnacle openclaw-barnacle Bot added plugin: bonjour Plugin integration: bonjour size: M and removed size: S labels Apr 26, 2026
@PratikRai0101 PratikRai0101 changed the title fix(gateway): suppress Windows console flicker from TUI and Bonjour A… fix(gateway): suppress Windows console flicker and prevent Bonjour fatal crashes (#70238, #72344, #72339) Apr 26, 2026
Comment thread extensions/bonjour/src/advertiser.ts
@PratikRai0101

Copy link
Copy Markdown
Contributor Author

@greptile-review

@PratikRai0101 PratikRai0101 force-pushed the fix/windows-gateway-bonjour-flicker branch from ef0e4d9 to 5e14317 Compare April 26, 2026 21:04
@clawsweeper

clawsweeper Bot commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Codex automated review: keeping this open.

Keep PR #72332 open. Current main still does not contain the PR’s remaining Windows flicker and Bonjour dependency-hardening work: the TUI relaunch spawn lacks windowsHide, the Bonjour plugin still resolves unpatched @homebridge/ciao@1.3.6, and current advertiser handling only partially covers ciao cancellation/assertion failures without the PR’s EADDRINUSE self-disable path. The PR is recent, contributor-authored, has no protected labels, and is tied to active/recent user bug reports, so it should get maintainer review rather than cleanup closure.

Best possible solution:

Keep the PR open for maintainer review/refinement. Preserve the useful fixes for the TUI windowsHide path, Bonjour EADDRINUSE/conflict handling, and ciao hard-exit/Windows exec behavior; add focused regression tests or strong manual verification for those surfaces; remove unrelated churn; and get explicit maintainer approval for the @homebridge/ciao patch or replace it with an OpenClaw-owned wrapper/upstreamed dependency fix.

What I checked:

  • No auto-protection blocker: The provided PR context shows author association CONTRIBUTOR and labels size: M and plugin: bonjour; none of the protected labels (security, beta-blocker, release-blocker, maintainer) are present.
  • TUI relaunch still lacks Windows hiding: Current main spawns the relaunched TUI with stdio and env only; there is no windowsHide: true in this path, which is one of the explicit PR fixes. (src/tui/tui-launch.ts:101, ff6044f4411d)
  • No TUI regression guard for windowsHide: The TUI launch tests assert stdio: "inherit" via expect.objectContaining, but they do not assert windowsHide, so current main has no test proving the flicker fix. (src/tui/tui-launch.test.ts:70, ff6044f4411d)
  • Bonjour still depends on unpatched ciao: The Bonjour plugin depends on @homebridge/ciao with specifier ^1.3.6, while root patchedDependencies only contains the Baileys patch. The lockfile resolves ciao to plain 1.3.6 without a patch hash. (extensions/bonjour/package.json:7, ff6044f4411d)
  • Upstream ciao still has implicated hard exits and visible exec: Read-only npm tarball inspection of @homebridge/ciao@1.3.6 shows child_process.exec("arp -a | findstr ...") without windowsHide and process.exit(1) in CiaoService.js and Responder.js; current main has no local patch to replace those behaviors. (88c230ac43b5)
  • Current Bonjour mitigation is partial: Main classifies ciao cancellation/assertion process errors and has tests for the unhandled-rejection handler, but startAdvertising and watchdog re-advertise still log rejected advertise calls generically; no EADDRINUSE/address-in-use self-disable path from this PR exists in current main. (extensions/bonjour/src/advertiser.ts:326, ff6044f4411d)

Remaining risk / open question:

  • The PR adds a dependency patch for @homebridge/ciao; repo policy says dependency patches/overrides need explicit maintainer approval before landing.
  • The PR still needs focused maintainer review for test coverage around windowsHide, EADDRINUSE self-disable behavior, and the patched ciao hard-exit paths.
  • The submitted diff includes at least one unrelated formatting-only test change, so it should be cleaned up or split before merge.

Codex Review notes: model gpt-5.5, reasoning high; reviewed against ff6044f4411d.

@PratikRai0101 PratikRai0101 force-pushed the fix/windows-gateway-bonjour-flicker branch 2 times, most recently from c460d38 to cd2c95d Compare April 26, 2026 21:19
@PratikRai0101 PratikRai0101 force-pushed the fix/windows-gateway-bonjour-flicker branch from a59c678 to 09207c0 Compare April 27, 2026 12:44
@PratikRai0101 PratikRai0101 requested a review from a team as a code owner April 27, 2026 12:44
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime extensions: diagnostics-otel Extension: diagnostics-otel extensions: memory-core Extension: memory-core scripts Repository scripts commands Command implementations docker Docker and sandbox tooling agents Agent runtime and tooling extensions: codex labels Apr 27, 2026
@PratikRai0101 PratikRai0101 force-pushed the fix/windows-gateway-bonjour-flicker branch 2 times, most recently from 00282b6 to 72bab68 Compare April 27, 2026 12:49
@openclaw-barnacle openclaw-barnacle Bot added size: M and removed docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime extensions: diagnostics-otel Extension: diagnostics-otel extensions: memory-core Extension: memory-core scripts Repository scripts commands Command implementations docker Docker and sandbox tooling agents Agent runtime and tooling extensions: codex size: XL labels Apr 27, 2026
@PratikRai0101 PratikRai0101 force-pushed the fix/windows-gateway-bonjour-flicker branch from 72bab68 to c642452 Compare April 27, 2026 12:55
vivy-yi pushed a commit to vivy-yi/openclaw that referenced this pull request Apr 27, 2026
- Google Meet integration: realtime voice sessions, participant plugin
- DeepSeek V4 Flash + V4 Pro added to bundled catalog
- Voice Call: realtime voice loops + webhook mode
- Browser automation: coordinate clicks, longer action budgets
- Memory-core: WAL journal mode default (~30% write performance)
- Plugin SDK: workflow action/outbound/scheduler/retry seams (openclaw#72384/openclaw#72383)
- Bug fixes: Bonjour crash loop (openclaw#72332), Google Meet cleanup (openclaw#72372)
- Breaking: removed registerEmbeddedExtensionFactory compatibility path
- Refs: github-sync-2026-04-27
@vincentkoc vincentkoc self-assigned this Apr 27, 2026
@steipete

Copy link
Copy Markdown
Contributor

Thanks @PratikRai0101. I rechecked this against current main, and the PR is now superseded by maintainer-side fixes that already landed.

What is already fixed on main:

I’m closing this PR rather than merging it because the linked crash/window-flicker issues are already fixed on main, while this branch still adds a dependency patch and package metadata churn that we should not carry now that the repo-owned scoped fixes exist.

The newer DNS-label crash in #37705 is a different Bonjour issue and is being tracked separately in #72809.

@steipete

Copy link
Copy Markdown
Contributor

Closing as superseded by current main; details in the maintainer comment above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: bonjour Plugin integration: bonjour size: M

Projects

None yet

3 participants