Skip to content

fix(memory): warn after startup watcher pressure check#89244

Merged
RomneyDa merged 16 commits into
mainfrom
fix/memory-watch-warning-threshold
Jun 3, 2026
Merged

fix(memory): warn after startup watcher pressure check#89244
RomneyDa merged 16 commits into
mainfrom
fix/memory-watch-warning-threshold

Conversation

@RomneyDa
Copy link
Copy Markdown
Member

@RomneyDa RomneyDa commented Jun 1, 2026

Summary

  • add a shared memory watcher-pressure warning helper for built-in memory and QMD watchers
  • warn only from runtime watcher state, not from config validation or a recursive startup scan
  • keep the warning one-shot per manager and avoid continuous watcher polling
  • cover built-in chokidar, Linux native directory watcher, and QMD watcher pressure paths with focused tests

How the warning works

  • Chokidar-backed memory watchers warn on ready, after Chokidar has populated its initial watched state.
  • Built-in memory watching also schedules one startup pressure sample 10 seconds after watcher setup finishes, then stops.
  • Linux native directory watching uses that startup sample to aggregate directory watcher pressure across watched roots.
  • Runtime native-to-chokidar fallback still restores coverage. A newly-created fallback watcher warns on its own ready; extending an already-ready watcher is not continuously polled.
  • QMD collection watching uses the same watched-entry counter and warning helper, but samples from its own Chokidar ready callback.

Related

Verification

  • node scripts/run-vitest.mjs extensions/memory-core/src/memory/manager.watcher-config.test.ts extensions/memory-core/src/memory/qmd-manager.test.ts
  • pnpm exec oxlint extensions/memory-core/src/memory/manager-sync-ops.ts extensions/memory-core/src/memory/qmd-manager.ts extensions/memory-core/src/memory/watch-pressure.ts extensions/memory-core/src/memory/manager.watcher-config.test.ts extensions/memory-core/src/memory/qmd-manager.test.ts --deny-warnings
  • git diff --check origin/main...HEAD

@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Jun 1, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Jun 1, 2026

Codex review: needs maintainer review before merge. Reviewed June 3, 2026, 2:55 PM ET / 18:55 UTC.

Summary
The PR adds shared runtime memory watcher-pressure warning logic for built-in memory and QMD watchers, clears the new startup timer on close, and adds focused watcher tests.

PR surface: Source +113, Tests +72. Total +185 across 6 files.

Reproducibility: yes. from source inspection for the missing warning path: current main starts the relevant watchers without a high-pressure warning, and the linked FD-pressure issue documents large watched memory trees. I did not run a live large-tree gateway reproduction in this read-only review.

Review metrics: 1 noteworthy metric.

  • Config/default surfaces: 0 added, 0 changed, 0 removed. The reverted predecessor used config-validation warnings; this branch keeps the mitigation runtime-only and does not change upgrade defaults.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🌊 off-meta tidepool
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] This is intentionally diagnostic-only: it warns about high watcher pressure but does not reduce watcher counts or eliminate the underlying FD-pressure failure mode.

Maintainer options:

  1. Decide the mitigation before merge
    Land the runtime warning if maintainers accept warning-only mitigation, and track deeper adaptive watcher or FD-reduction work separately if needed.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P2] Protected maintainer/member PR with no narrow automated repair; the next action is maintainer judgment on warning-only mitigation plus normal merge validation.

Security
Cleared: No concrete security or supply-chain concern found; the diff is limited to memory-core TypeScript and tests with no dependency, workflow, lockfile, permission, or secret-handling changes.

Review details

Best possible solution:

Land the runtime warning if maintainers accept warning-only mitigation, and track deeper adaptive watcher or FD-reduction work separately if needed.

Do we have a high-confidence way to reproduce the issue?

Yes from source inspection for the missing warning path: current main starts the relevant watchers without a high-pressure warning, and the linked FD-pressure issue documents large watched memory trees. I did not run a live large-tree gateway reproduction in this read-only review.

Is this the best way to solve the issue?

Yes as a bounded mitigation, but not as a complete FD-pressure fix: the PR moves warning policy to actual watcher state and leaves config/default behavior intact. Maintainers still need to decide whether warning-only behavior is sufficient for this FD-pressure family.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 892602eaba07.

Label changes

Label justifications:

  • P2: The PR addresses a real memory watcher FD-pressure diagnostic with bounded plugin-runtime impact, not an emergency outage or security issue.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The PR is maintainer/member-authored, so the external-contributor real behavior proof gate does not apply; the PR body lists focused test, lint, and diff-check commands.
Evidence reviewed

PR surface:

Source +113, Tests +72. Total +185 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 4 135 22 +113
Tests 2 82 10 +72
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 217 32 +185

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs extensions/memory-core/src/memory/manager.watcher-config.test.ts extensions/memory-core/src/memory/qmd-manager.test.ts.
  • [P1] pnpm exec oxlint extensions/memory-core/src/memory/manager-sync-ops.ts extensions/memory-core/src/memory/qmd-manager.ts extensions/memory-core/src/memory/watch-pressure.ts extensions/memory-core/src/memory/manager.watcher-config.test.ts extensions/memory-core/src/memory/qmd-manager.test.ts --deny-warnings.
  • [P1] git diff --check origin/main...HEAD.

What I checked:

Likely related people:

  • RomneyDa: They authored the merged gateway watcher warning PR and the follow-up revert referenced by this PR, so they are connected to the warning-policy history beyond only opening this branch. (role: recent warning-flow contributor; confidence: high; commits: 2405bbcbafa6, 0904f3e5539d; files: extensions/memory-core/src/memory/qmd-manager.ts, extensions/memory-core/src/memory/qmd-manager.test.ts, src/config/validation.ts)
  • Vincent Koc: git blame attributes the current built-in and QMD watcher setup lines to commit eddf1c7 in this checkout. (role: current-main line owner; confidence: medium; commits: eddf1c776dd2; files: extensions/memory-core/src/memory/manager-sync-ops.ts, extensions/memory-core/src/memory/qmd-manager.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jun 1, 2026
@RomneyDa RomneyDa force-pushed the fix/memory-watch-warning-threshold branch from a36756a to 18e300b Compare June 1, 2026 22:28
@RomneyDa RomneyDa force-pushed the fix/memory-watch-warning-threshold branch from 18e300b to 70e32c1 Compare June 1, 2026 22:34
@RomneyDa RomneyDa changed the title fix(config): warn only on large memory watch trees fix(config): warn on large memory watch FD risk Jun 1, 2026
@byungskers
Copy link
Copy Markdown

Bounded scan makes sense, but I wanted to flag one edge case: returning false after MEMORY_WATCH_FD_WARNING_SCAN_ENTRY_LIMIT means a very large tree can avoid the warning entirely if the first 20k entries don't push markdownFiles past the threshold yet.

Maybe that tradeoff is intentional, but if so I'd love a short comment near the early return explaining that this is a best-effort heuristic and can under-warn on huge trees. That would help future readers avoid treating the warning as exhaustive.

@RomneyDa
Copy link
Copy Markdown
Member Author

RomneyDa commented Jun 2, 2026

@clawsweeper re-review

@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Jun 2, 2026

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@RomneyDa RomneyDa force-pushed the fix/memory-watch-warning-threshold branch from b774472 to 0942d34 Compare June 2, 2026 06:15
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime scripts Repository scripts labels Jun 2, 2026
@RomneyDa RomneyDa force-pushed the fix/memory-watch-warning-threshold branch 2 times, most recently from 94e8013 to ec1eb08 Compare June 2, 2026 06:40
@RomneyDa
Copy link
Copy Markdown
Member Author

RomneyDa commented Jun 2, 2026

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot removed gateway Gateway runtime scripts Repository scripts labels Jun 2, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Jun 2, 2026

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@RomneyDa
Copy link
Copy Markdown
Member Author

RomneyDa commented Jun 2, 2026

@clawsweeper re-review

@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Jun 2, 2026

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jun 2, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 3, 2026
@RomneyDa RomneyDa marked this pull request as ready for review June 3, 2026 17:00
@RomneyDa RomneyDa force-pushed the fix/memory-watch-warning-threshold branch from 1bcfc66 to 539f4f2 Compare June 3, 2026 18:03
@RomneyDa RomneyDa changed the title fix(memory): warn on startup watcher pressure fix(memory): warn after startup watcher pressure check Jun 3, 2026
@RomneyDa
Copy link
Copy Markdown
Member Author

RomneyDa commented Jun 3, 2026

@clawsweeper re-review

@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Jun 3, 2026

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@RomneyDa RomneyDa merged commit f0237ca into main Jun 3, 2026
152 checks passed
@RomneyDa RomneyDa deleted the fix/memory-watch-warning-threshold branch June 3, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-core Extension: memory-core maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants