-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Feature: sync.watch should default to false in gateway mode #71335
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Type
Fields
Priority
None yet
Problem
When OpenClaw runs as a headless gateway (gateway.mode set),
memorySearch.sync.watchdefaults totrue, which creates a chokidar file watcher for every memory file and extra path. On a multi-agent gateway this leaks file descriptors — we observed 1,292 chokidar watchers on a single instance.Interactive desktop use benefits from near-real-time reindexing on file change. A headless gateway with many agents does not — files rarely change externally, and the FD cost is disproportionate.
Proposed Change
Default
sync.watchtofalsewhen the process detects it is running in gateway mode (i.e., whengateway.modeis set to any non-CLI value).Falling back:
agents.defaults.memorySearch.sync.watch→falsewhen gateway modesync.watch: truein config still wins (user override)trueby default)Alternative considered
Replace chokidar
awaitWriteFinishpolling with native FSEvents on macOS to avoid per-file FD allocation. This would help on macOS but not on Linux gateways, and does not address the fundamental problem of O(n) watchers per agent.Impact
Workaround
Set
sync.watch: falseinopenclaw.jsonunderagents.defaults.memorySearch.sync. This is already documented in the schema help text but should be the default for gateway mode.Related: #64549 (watch does not auto-index new files — separate bug, but same subsystem)