fix(memory): warn on gateway watcher FD risk#89185
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 1, 2026, 4:28 PM ET / 20:28 UTC. Summary PR surface: Source +96, Tests +129, Docs +6. Total +231 across 10 files. Reproducibility: yes. for the QMD watcher error path from source: current main has no QMD watcher Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land only after maintainers explicitly accept warning-first resolution for gateway memory-watch FD pressure, including the warning breadth and whether that should close the existing default-off request. Do we have a high-confidence way to reproduce the issue? Yes for the QMD watcher error path from source: current main has no QMD watcher Is this the best way to solve the issue? Unclear as a final product decision: the patch is a compatible mitigation and the QMD error listener is the right sibling-aligned repair, but warning-only handling is not the only possible answer to gateway FD pressure. Maintainers should choose between accepting the warning-first policy, narrowing the warnings, or leaving the default-off issue open. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against fe97c6000c5c. Label changesLabel justifications:
Evidence reviewedPR surface: Source +96, Tests +129, Docs +6. Total +231 across 10 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
8239ff2 to
eaa0b8f
Compare
eaa0b8f to
624702e
Compare
|
Addressed the ClawSweeper feedback.
Verification:
Final pushed head: @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Updated this PR to keep memory watching enabled by default and move the FD-pressure handling to warnings.
Verification:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
Fixed the CI failures from the warning-helper follow-up. Root cause: the first helper shape let TypeScript narrow optional Local verification added after the CI failures:
Latest CI run @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞👀 Command router queued. I will update this comment with the next step. Re-review progress:
|
|
Cleaned up the docs/comment wording in
Verification for this cleanup:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
* fix(memory): default gateway memory watch off * fix(memory): warn on gateway watcher fd risk * fix(config): avoid warning helper narrowing * fix(config): remove redundant warning boolean cast * docs(memory): clarify watcher default wording * docs(memory): simplify watcher warning copy * fix(config): scope watcher warning to local gateway
* fix(memory): default gateway memory watch off * fix(memory): warn on gateway watcher fd risk * fix(config): avoid warning helper narrowing * fix(config): remove redundant warning boolean cast * docs(memory): clarify watcher default wording * docs(memory): simplify watcher warning copy * fix(config): scope watcher warning to local gateway
* fix(memory): default gateway memory watch off * fix(memory): warn on gateway watcher fd risk * fix(config): avoid warning helper narrowing * fix(config): remove redundant warning boolean cast * docs(memory): clarify watcher default wording * docs(memory): simplify watcher warning copy * fix(config): scope watcher warning to local gateway
Summary
memorySearch.sync.watchdefault (true) in gateway mode so small and typical gateway workspaces keep live memory freshness.extraPaths, QMD collections, session-memory indexing, or multi-agent gateways.sync.watch: falseas the explicit mitigation, and make QMD watchererrorevents log instead of crashing the gateway.Fixes #71335.
Why This Shape
The first commit on this branch tried to make unset gateway
memorySearch.sync.watchdefault tofalse. That avoids long-lived watcher FD pressure, but it can make the average gateway user's memory UX worse: file edits may stay stale indefinitely unless they restart, manually reindex, configure an interval, or opt back into watching.This updated approach keeps the current default-on behavior and adds operator-facing warnings instead. The warning points users with higher-risk gateway configs toward
sync.watch: falsewithout surprising small or several-month memory users who rely on live indexing.A smarter future fix could make watching adaptive, for example by watching only recent files, applying thresholds, or choosing a lower-FD backend per platform. This PR does not add a new config option.
Related Issues And PRs
sync.watchdefault policy out of scope.Behavior
sync.watch: still resolves totrue, including gateway mode.sync.watch: true: still enables watching.sync.watch: false: still disables watching and remains the recommended mitigation for FD pressure.errorevents log a warning instead of surfacing as unhandled EventEmitter errors.Verification
node scripts/run-vitest.mjs src/agents/memory-search.test.ts src/config/validation.policy.test.ts extensions/memory-core/src/memory/qmd-manager.test.tsnode scripts/run-vitest.mjs src/config/validation.policy.test.tspnpm exec oxfmt --check --threads=1 docs/concepts/memory-builtin.md docs/reference/memory-config.md src/agents/memory-search.ts src/agents/memory-search.test.ts src/config/schema.help.ts src/config/types.tools.ts src/config/validation.policy.test.ts src/config/validation.ts extensions/memory-core/src/memory/qmd-manager.ts extensions/memory-core/src/memory/qmd-manager.test.tspnpm exec oxfmt --check --threads=1 src/config/validation.tspnpm docs:check-mdxpnpm exec oxfmt --check --threads=1 docs/concepts/memory-builtin.md docs/reference/memory-config.md extensions/memory-core/src/memory/qmd-manager.ts src/agents/memory-search.ts src/config/schema.help.ts src/config/types.tools.tsgit diff --check origin/main..HEAD && git diff --checkpnpm tsgo:corepnpm tsgo:core:testpnpm tsgo:prodNODE_OPTIONS=--max-old-space-size=8192 pnpm build:plugin-sdk:strict-smokepnpm lint --threads=8.agents/skills/autoreview/scripts/autoreview --mode local26779072956passed ond4cc83b6075395f76a951bd295035422a56b5ab9