openclaw - ✅(Solved) Fix [Bug]: Gmail watcher duplicates and causes port 8788 bind conflict in OpenClaw [4 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#65042Fetched 2026-04-12 13:25:53
View on GitHub
Comments
0
Participants
1
Timeline
8
Reactions
0
Participants
Timeline (top)
cross-referenced ×4labeled ×2referenced ×2

Environment OpenClaw 2026.4.10 gogcli 0.12.0 macOS (Mac Mini)

What works Gmail webhook setup succeeds. Watcher initializes correctly. Logs show:

  • gmail watcher started
  • hooks gmail watcher started

Issue The Gmail watcher starts successfully on port 8788, but OpenClaw later attempts to start it again, causing a duplicate bind error.

Observed behavior First watcher process runs correctly and listens on 127.0.0.1:8788.

Later, OpenClaw attempts to start another watcher: listen tcp 127.0.0.1:8788: bind: address already in use

Important detail This occurs even after:

  • stopping gateway
  • killing all gog processes
  • restarting clean

Expected behavior Only one watcher should run per account.

Actual behavior OpenClaw repeatedly attempts to start a second watcher despite an active one already running.

Evidence Active process: gog gmail watch serve --account [email protected] --bind 127.0.0.1 --port 8788 ...

Logs show repeated: [gmail-watcher] starting gog gmail watch serve ...

Direct gog test Running on a different port (8799) works fine, suggesting the issue is in OpenClaw watcher lifecycle management.

Question Is this a known issue with gmail-watcher restart logic or gateway lifecycle? Any recommended workaround?

Error Message

The Gmail watcher starts successfully on port 8788, but OpenClaw later attempts to start it again, causing a duplicate bind error.

Root Cause

Environment OpenClaw 2026.4.10 gogcli 0.12.0 macOS (Mac Mini)

What works Gmail webhook setup succeeds. Watcher initializes correctly. Logs show:

  • gmail watcher started
  • hooks gmail watcher started

Issue The Gmail watcher starts successfully on port 8788, but OpenClaw later attempts to start it again, causing a duplicate bind error.

Observed behavior First watcher process runs correctly and listens on 127.0.0.1:8788.

Later, OpenClaw attempts to start another watcher: listen tcp 127.0.0.1:8788: bind: address already in use

Important detail This occurs even after:

  • stopping gateway
  • killing all gog processes
  • restarting clean

Expected behavior Only one watcher should run per account.

Actual behavior OpenClaw repeatedly attempts to start a second watcher despite an active one already running.

Evidence Active process: gog gmail watch serve --account [email protected] --bind 127.0.0.1 --port 8788 ...

Logs show repeated: [gmail-watcher] starting gog gmail watch serve ...

Direct gog test Running on a different port (8799) works fine, suggesting the issue is in OpenClaw watcher lifecycle management.

Question Is this a known issue with gmail-watcher restart logic or gateway lifecycle? Any recommended workaround?

Fix Action

Fix / Workaround

Question Is this a known issue with gmail-watcher restart logic or gateway lifecycle? Any recommended workaround?

PR fix notes

PR #65146: fix(gmail): set stopped=true on addressInUse to prevent duplicate watcher restart

Description (problem / solution / changelog)

Closes #65042

Changed files

  • extensions/memory-core/src/dreaming-narrative.ts (modified, +2/-0)
  • src/agents/pi-embedded-runner/run.ts (modified, +34/-0)
  • src/agents/pi-embedded-runner/run/incomplete-turn.ts (modified, +1/-2)
  • src/auto-reply/reply/delivery-fallback.ts (added, +51/-0)
  • src/gateway/server-methods/chat.directive-tags.test.ts (modified, +31/-0)
  • src/gateway/server-methods/chat.ts (modified, +3/-0)
  • src/hooks/gmail-watcher.ts (modified, +13/-2)
  • src/plugin-sdk/delivery-fallback.ts (added, +8/-0)
  • src/secrets/resolve.test.ts (modified, +16/-0)
  • src/secrets/resolve.ts (modified, +9/-1)

PR #65163: fix(gmail): set stopped=true on addressInUse to prevent duplicate watcher restart

Description (problem / solution / changelog)

Closes #65042

Changed files

  • extensions/memory-core/src/dreaming-narrative.ts (modified, +2/-0)
  • extensions/qa-lab/src/discovery-eval.ts (modified, +10/-1)
  • package.json (modified, +1/-0)
  • src/agents/pi-embedded-runner/run.ts (modified, +34/-0)
  • src/agents/pi-embedded-runner/run/incomplete-turn.ts (modified, +1/-2)
  • src/auto-reply/reply/delivery-fallback.ts (added, +51/-0)
  • src/gateway/server-methods/chat.directive-tags.test.ts (modified, +31/-0)
  • src/gateway/server-methods/chat.ts (modified, +3/-0)
  • src/hooks/gmail-watcher.ts (modified, +14/-2)
  • src/plugin-sdk/delivery-fallback.ts (added, +8/-0)
  • src/secrets/resolve.test.ts (modified, +16/-0)
  • src/secrets/resolve.ts (modified, +9/-1)

PR #65196: fix(gmail): set stopped=true on addressInUse to prevent duplicate watcher restart

Description (problem / solution / changelog)

Summary

Fix Gmail watcher duplicate start issue (#65042): when port 8788 is already in use, set stopped=true to prevent repeated restart attempts.

Changes

  • src/hooks/gmail-watcher.ts: set stopped=true when addressInUse
  • extensions/qa-lab/src/discovery-eval.ts: +11/-1
  • package.json: +1 (gogcli dep)

Testing

  • Fixes port 8788 EADDRINUSE error on duplicate watcher start
  • Maintains single watcher per account invariant

Closes #65042

Changed files

  • extensions/memory-core/src/dreaming-narrative.ts (modified, +2/-0)
  • extensions/qa-lab/src/discovery-eval.ts (modified, +10/-1)
  • package.json (modified, +1/-0)
  • src/agents/pi-embedded-runner/run.ts (modified, +34/-0)
  • src/agents/pi-embedded-runner/run/incomplete-turn.ts (modified, +1/-2)
  • src/auto-reply/reply/delivery-fallback.ts (added, +51/-0)
  • src/gateway/server-methods/chat.directive-tags.test.ts (modified, +31/-0)
  • src/gateway/server-methods/chat.ts (modified, +3/-0)
  • src/hooks/gmail-watcher.ts (modified, +14/-2)
  • src/plugin-sdk/delivery-fallback.ts (added, +8/-0)
  • src/secrets/resolve.test.ts (modified, +16/-0)
  • src/secrets/resolve.ts (modified, +9/-1)

PR #65230: fix(gmail): set stopped=true on addressInUse to prevent duplicate watcher restart

Description (problem / solution / changelog)

Summary

Fix Gmail watcher duplicate start issue (#65042): when port 8788 is already in use, set stopped=true to prevent repeated restart attempts.

Changes

  • Add stopped state variable to track intentional stops
  • In spawnGogServe exit handler: guard with || stopped to prevent restart after intentional stop
  • In addressInUse block: set stopped = true so watcher doesn't keep retrying
  • In startGmailWatcher: add guard to refuse starting if watcherProcess != null
  • In stopGmailWatcher: set stopped = true to prevent restart after stop

Testing

  • Fixes port 8788 EADDRINUSE error on duplicate watcher start
  • Maintains single watcher per account invariant
  • Graceful degradation: existing watcher takes precedence

Closes #65042

Changed files

  • src/hooks/gmail-watcher.ts (modified, +14/-2)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Environment OpenClaw 2026.4.10 gogcli 0.12.0 macOS (Mac Mini)

What works Gmail webhook setup succeeds. Watcher initializes correctly. Logs show:

  • gmail watcher started
  • hooks gmail watcher started

Issue The Gmail watcher starts successfully on port 8788, but OpenClaw later attempts to start it again, causing a duplicate bind error.

Observed behavior First watcher process runs correctly and listens on 127.0.0.1:8788.

Later, OpenClaw attempts to start another watcher: listen tcp 127.0.0.1:8788: bind: address already in use

Important detail This occurs even after:

  • stopping gateway
  • killing all gog processes
  • restarting clean

Expected behavior Only one watcher should run per account.

Actual behavior OpenClaw repeatedly attempts to start a second watcher despite an active one already running.

Evidence Active process: gog gmail watch serve --account [email protected] --bind 127.0.0.1 --port 8788 ...

Logs show repeated: [gmail-watcher] starting gog gmail watch serve ...

Direct gog test Running on a different port (8799) works fine, suggesting the issue is in OpenClaw watcher lifecycle management.

Question Is this a known issue with gmail-watcher restart logic or gateway lifecycle? Any recommended workaround?

Steps to reproduce

  1. Configure Gmail webhooks for a Gmail account using openclaw webhooks gmail setup. 2. Start OpenClaw 2026.4.10 with the Gmail watcher enabled via the gateway. 3. Confirm the first watcher starts successfully: • gateway log shows watch started for <account> • gateway log shows gmail watcher started • lsof -nP -iTCP:8788 -sTCP:LISTEN shows one gog gmail watch serve process listening on 127.0.0.1:8788 4. Leave the gateway running for a few minutes without manually starting another watcher. 5. Observe repeated later log entries: • [gmail-watcher] starting gog gmail watch serve --account <account> --bind 127.0.0.1 --port 8788 ... while the original watcher is still alive and already listening on port 8788. 6. Confirm the duplicate-start symptom by checking that the original watcher PID is still present and holding 127.0.0.1:8788.

Expected behavior

In 2026.2.10, the Gmail watcher initialized a single gog gmail watch serve process per account and maintained a stable listener on the configured port without spawning duplicates.

Under the same configuration and workflow, OpenClaw should: • Start only one Gmail watcher per account • Avoid re-spawning additional watchers if one is already active • Prevent port conflicts on 127.0.0.1:8788 • Maintain a stable, continuous watch process without repeated restart attempts

No additional starting gog gmail watch serve events should occur unless the existing watcher has stopped or failed.

Actual behavior

No reply is posted in the Gmail thread. The gateway log shows repeated attempts to process the event, but fails with “reply target not found,” and no message is created despite the watcher running and receiving events.

OpenClaw version

2026.4.10 (44e5b62)

Operating system

macOS (Apple Silicon, Mac mini, zsh)

Install method

Homebrew (gogcli) + local OpenClaw CLI (launchd gateway)

Model

openai/gpt-5.1-codex

Provider / routing chain

openclaw -> local gateway -> gogcli (gmail watch) -> Google Pub/Sub

Additional provider/model setup details

Local OpenClaw gateway with Gmail watcher enabled via gogcli (Homebrew). Gmail integration uses Google Pub/Sub push to a local webhook endpoint (127.0.0.1:18789/hooks/gmail) with Tailscale funnel on port 8788.

Watcher is auto-managed by the gateway and repeatedly attempts to start gog gmail watch serve on the same port.

Relevant config located at ~/.openclaw/openclaw.json.

Logs, screenshots, and evidence

Impact and severity

Affected: Gmail watcher / email automation via OpenClaw Severity: High (blocks outbound email replies entirely) Frequency: Consistent (reproduces on every attempt) Consequence: Agent receives events but fails to send replies, resulting in missed communications and broken automation workflows

Additional information

Affected: Gmail watcher / email automation via OpenClaw Severity: High (blocks outbound email replies and causes unstable watcher behavior) Frequency: Consistent (reproduces on every attempt)

Consequence: • Agent receives Gmail events but fails to send replies (“reply target not found”) • Gmail watcher repeatedly attempts to restart on the same port (8788), causing port conflicts • Results in broken email automation and unreliable watcher lifecycle overall

This makes it clear the issue isn’t isolated—it’s both messaging + watcher management failing together.

extent analysis

TL;DR

The most likely fix is to modify OpenClaw's watcher lifecycle management to prevent duplicate starts of the Gmail watcher process.

Guidance

  • Review the OpenClaw configuration file (~/.openclaw/openclaw.json) to ensure that the Gmail watcher settings are correctly configured and not causing the duplicate start issue.
  • Investigate the OpenClaw gateway's logic for managing the Gmail watcher process to identify why it is attempting to start multiple instances of the watcher.
  • Consider implementing a check to see if a Gmail watcher process is already running before attempting to start a new one, to prevent duplicate starts and port conflicts.
  • Verify that the issue is not related to the gogcli version (0.12.0) or the macOS environment, by testing with a different version or environment if possible.

Example

No code example is provided as the issue is related to the OpenClaw configuration and gateway logic, which is not explicitly stated in the issue.

Notes

The issue may be related to a regression in the OpenClaw version (2026.4.10) compared to the previous version (2026.2.10), where the Gmail watcher initialized a single process per account without spawning duplicates.

Recommendation

Apply a workaround to modify the OpenClaw configuration or gateway logic to prevent duplicate starts of the Gmail watcher process, as the root cause of the issue is likely related to the watcher lifecycle management.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

In 2026.2.10, the Gmail watcher initialized a single gog gmail watch serve process per account and maintained a stable listener on the configured port without spawning duplicates.

Under the same configuration and workflow, OpenClaw should: • Start only one Gmail watcher per account • Avoid re-spawning additional watchers if one is already active • Prevent port conflicts on 127.0.0.1:8788 • Maintain a stable, continuous watch process without repeated restart attempts

No additional starting gog gmail watch serve events should occur unless the existing watcher has stopped or failed.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: Gmail watcher duplicates and causes port 8788 bind conflict in OpenClaw [4 pull requests, 1 participants]