Skip to content

feat(fseventsd): doctor warns when fseventsd uses over 2 GB on a macOS worker - #1738

Merged
V3RON merged 20 commits into
feature/1733-adrfrom
task/1735
Nov 18, 2026
Merged

V3RON merged 20 commits into
feature/1733-adrfrom
task/1735

Conversation

@V3RON

@V3RON V3RON commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1735

Status

Implement: done (audit 6/6, fixes R1–R9) Review: passed (round 1, round 2, fix-check) Hardware: n/a Gate: waiting for the stack
Next: ADR 0088 flip to Accepted on this branch, then stack sync and the gate on #1738

Assumptions

  • Assumption: the module adds a hostPlatform option to the config loader, unset meaning "not macOS" — so a test that does not ask never turns the module on by the machine it runs on; STANDALONE_OFF pins fseventsd off for daemon tests.
  • Assumption: how long may a module-advisory's message and remedy be on the wire — at most 1000 characters each, as the wire-input rule asks.

Done when

  • pnpm test:changed and pnpm typecheck pass. — the audit's and fix runs' pre-commit hooks (7021 tests); CI Static checks pass on 3a160b0
  • pnpm --dir website install && pnpm --dir website build && node website/scripts/check-openapi.mjs passes (the diff touches website/, src/contract/ and src/modules/). — CI Website workflow (build and check-openapi) passes on 3a160b0
  • PROTOCOL_VERSION_RANGE in src/contract/protocol.ts is one higher than at the base commit. — 99 to 100; CI Protocol bump passes
  • B1's and B5's tests use a fake ProcessRunner and hostPlatform; nothing boots a device and nothing runs the real top. — audit read the tests: scripted runner and hostPlatform values only

Completion conditions

  • On a macOS worker whose fseventsd is over 2 GB, simlock doctor prints the warning line on stderr and a module-advisory finding in its JSON. — B1 (28G gives the finding) and B4 (the CLI warning line) tests
  • At 2 GB or less, simlock doctor shows no fseventsd finding. — B1 tests: 2048M and 1.5G give none
  • After sudo killall fseventsd, the next simlock doctor shows no fseventsd finding. — B1 test: a 28G run then a 14M run, finding then none (the read is live per run)
  • On Linux, the worker runs no pgrep or top, simlock doctor shows no fseventsd finding, and config.get shows capabilities.fseventsd.enabled: false. — B5 tests: linux unset gives false; linux true gives unavailable with no pgrep
  • The worker troubleshooting page has the section with the check command, the manual restart and the hourly launchd job with its removal. — B6, checked by the round 2 spec lens against the page diff; Website build passes

Review

Spec review: 7 blocking, 7 fixed, 0 notes. Code review: 1 blocking, 1 fixed, 0 notes. Claims review: 1 blocking, 1 fixed, 0 notes.
Rounds: 2. Tokens: 9.5M.
Runs: 14. Cost USD: 5.972. Agent seconds: 2449.

Assessment: complete

Written by an agent.

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Adds the optional fseventsd module, enabled by default on macOS workers. The module reads process memory and reports an advisory when usage exceeds 2 GiB. Module findings can now be asynchronous, are collected concurrently with a 15-second deadline, and advisories are excluded from drift and printed by simlock doctor. The change also updates the finding schema, protocol version, tests, configuration and troubleshooting documentation, and ADR statuses.

Severity of issue fixed: Low

Merge Risk: Minimal · up to 416d7

This adds an advisory-only fseventsd memory warning to doctor on macOS workers. It does not change drift behavior, and no concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a doctor warning when fseventsd memory exceeds 2 GB on a macOS worker. The summary files confirm a new fseventsd module, a module-advisory finding, and the doctor outp…
Description check Passed The description links issue #1735, lists status and completion checks, and names the fseventsd doctor check, the 99 to 100 protocol bump, and the fake ProcessRunner and hostPlatform tests. These match…
Linked Issues check Passed Stack objectives for #1735 (stack: #1734 reviewed ADR, #1738 current PR).

1. [#1735] Doctor reads fseventsd memory on macOS and warns above 2 GB with a fix. Addressed. src/fseventsd/worker.ts reads t…
Out of Scope Changes check Passed Changes introduced by #1738 were reviewed against the feature scope. Feature code (src/fseventsd/, src/modules/host.ts, types.ts, testing.ts, src/core/doctor.ts, config*.ts, create-core.ts, src/daem…
Full details: Title check

Explanation

The title names the main change: a doctor warning when fseventsd memory exceeds 2 GB on a macOS worker. The summary files confirm a new fseventsd module, a module-advisory finding, and the doctor output changes that match this title.

Full details: Description check

Explanation

The description links issue #1735, lists status and completion checks, and names the fseventsd doctor check, the 99 to 100 protocol bump, and the fake ProcessRunner and hostPlatform tests. These match the changeset, so the description is related to the change.

Full details: Linked Issues check

Explanation

Stack objectives for #1735 (stack: #1734 reviewed ADR, #1738 current PR).

  1. [#1735] Doctor reads fseventsd memory on macOS and warns above 2 GB with a fix. Addressed. src/fseventsd/worker.ts reads the live figure each call (pgrep -x fseventsd, then top -l 1 -pid <pid> -stats mem) and returns an advisory finding with a restart remedy when bytes exceed 2 GiB. The CLI writes module-advisory findings to stderr (src/cli/commands/doctor.ts per summary). Contributing: #1738; design rules: #1734 (ADR 0088).

  2. [#1735] No finding at or below 2 GB, when the process is absent, or when a read fails. Addressed. worker.ts returns no finding for bytes <= LIMIT_BYTES, for pgrep exit 1 (absent), and for any failed reading (logged as a warning, empty result). Contributing: #1738.

  3. [#1735] Bounded waits. Addressed. READ_TIMEOUT_MS = 5000 per command in worker.ts; FINDINGS_DEADLINE_MS = 15000 for all module findings in src/modules/host.ts, with late modules omitted and a warning logged. Contributing: #1738.

  4. [#1735] Default on for macOS worker roles, off on Linux, unavailable (plus finding, no pgrep) when explicitly enabled on Linux. Addressed. definition.ts sets enabledByDefault: "macos-worker"; worker.ts returns unavailable with a finding and no process calls when hostPlatform is not darwin. Default resolution in src/core/config.ts was not read directly; it rests on the supplied current-PR summary and the reported B5 tests. Contributing: #1738; #1734 (ADR 0088 §1).

  5. [#1735] Advisory finding, not drift; protocol +1. Addressed. ModuleFinding.advisory maps to kind module-advisory in host.ts; the summary states isDrift excludes module-advisory and PROTOCOL_VERSION_RANGE moves 99 to 100. Contributing: #1738; #1734 (ADR 0088 §3).

  6. [#1735] Troubleshooting and configuration docs (manual restart, hourly launchd job, capability key). Addressed. Per the supplied summary, troubleshooting.mdx and configuration.mdx add the section and rows; the Website build is reported as passing. Contributing: #1738.

  7. [#1735] Stored state none; no pgrep on non-macOS. Addressed. No persistence in worker.ts; the non-darwin branch makes no process-runner calls.

Uncertainty: config.ts default resolution and the doc page content were established from summaries and reported test results, not from direct reads.

Full details: Out of Scope Changes check

Explanation

Changes introduced by #1738 were reviewed against the feature scope. Feature code (src/fseventsd/, src/modules/host.ts, types.ts, testing.ts, src/core/doctor.ts, config*.ts, create-core.ts, src/daemon/main.ts, test-main.ts, module-registry), the CLI doctor output and its test, the protocol version bump, the report schema variant, and the two website pages all connect to the fseventsd doctor warning or its required contract, docs, and tests. The daemon test-main.ts change disables fseventsd in STANDALONE_OFF so daemon tests do not run the real check; this is supporting test scaffolding. The ADR edits (0088 to Accepted, README index, 0030 and 0046 narrowing notes) and ARCHITECTURE.md row document the same design. The ADR 0046 status flip is the least directly tied change; the supplied summary does not show its implementation in this PR, but it is a status-only documentation change with no code effect, so it is not a demonstrated unrelated change. No unrelated behavior change was identified.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: cf83ffab-1c84-4a93-9a72-f31a53888a87
Commits

Reviewing files that changed from the base of the PR and between 69f00d9 and 416d72e.

Files selected for processing: 31

  • docs/internal/ARCHITECTURE.md
  • docs/internal/adr/0046-a-standalone-worker-serves-agent-device-by-default-with-a-private-profile.md
  • docs/internal/adr/0088-a-macos-worker-checks-fseventsd-when-doctor-runs.md
  • docs/internal/adr/README.md
  • src/cli/commands/doctor.ts
  • src/cli/index-daemon-status.test.ts
  • src/contract/protocol.ts
  • src/contract/report-schemas.ts
  • src/core/config-types.ts
  • src/core/config.ts
  • src/core/create-core.ts
  • src/core/doctor-advisories.test.ts
  • src/core/doctor-drift.ts
  • src/core/doctor-types.ts
  • src/core/doctor.ts
  • src/daemon/main.ts
  • src/daemon/test-main.ts
  • src/fseventsd/AGENTS.md
  • src/fseventsd/CLAUDE.md
  • src/fseventsd/definition.test.ts
  • src/fseventsd/definition.ts
  • src/fseventsd/index.ts
  • src/fseventsd/worker.test.ts
  • src/fseventsd/worker.ts
  • src/module-registry/index.ts
  • src/modules/host-findings.test.ts
  • src/modules/host.ts
  • src/modules/testing.ts
  • src/modules/types.ts
  • website/src/content/docs/docs/reference/configuration.mdx
  • website/src/content/docs/docs/worker/troubleshooting.mdx

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

@V3RON
V3RON added this pull request to stack #1739 November 18, 2026 19:35
@V3RON

V3RON commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Review ledger

Round 1: a5b5f54
Round 2: 753afdf
Round fix-check: 3a160b0

Runs: 14. Cost USD: 5.972. Agent seconds: 2449.
Tokens input 405, output 127265, cache read 14568651, cache write 856620.
- build implementer: claude-sonnet-5-5 858 s $1.6229
- audit implementer: claude-sonnet-5-5 144 s $0.4066
- review 1 reviewer: claude-sonnet-5-5 199 s $0.1951
- review 1 spec: claude-opus-5-5 75 s $0.569
- review 1 code behaviour: claude-opus-5-5 125 s $0.6633
- review 1 claims: claude-sonnet-5-5 69 s $0.2307
- fix 1 implementer: claude-sonnet-5-5 254 s $0.5105
- review 2 reviewer: claude-sonnet-5-5 221 s $0.203
- review 2 spec: claude-sonnet-5-5 58 s $0.1925
- review 2 code behaviour: claude-opus-5-5 145 s $0.6777
- review 2 claims: claude-sonnet-5-5 33 s $0.1427
- fix 2 implementer: claude-sonnet-5-5 77 s $0.153
- review fix-check reviewer: claude-sonnet-5-5 129 s $0.1147
- review fix-check code tests: claude-opus-5-5 62 s $0.2903
Finding outcomes: {"fixed":9}. Classes: {"documentation 7 manual restates code":1,"spec B6 troubleshooting section incomplete":1,"spec I3/I8 timeout constants":1,"spec I4 absolute paths and B unit":1,"spec I6 failed-reading warn reasons":1,"spec I6 finding message and remedy text":1,"spec I6 non-macOS unavailable message":1,"spec I8 timeout warn text":1,"testing 10 time boundary not straddled":1}.
{"findings":[{"id":"R1","role":"spec","class":"spec I3/I8 timeout constants","outcome":"fixed","path":"src/fseventsd/worker.ts","round":"1","fix":"753afdf0e"},{"id":"R2","role":"spec","class":"spec I6 finding message and remedy text","outcome":"fixed","path":"src/fseventsd/worker.ts","round":"1","fix":"753afdf0e"},{"id":"R3","role":"spec","class":"spec I6 failed-reading warn reasons","outcome":"fixed","path":"src/fseventsd/worker.ts","round":"1","fix":"753afdf0e"},{"id":"R4","role":"spec","class":"spec I6 non-macOS unavailable message","outcome":"fixed","path":"src/fseventsd/worker.ts","round":"1","fix":"753afdf0e"},{"id":"R5","role":"spec","class":"spec I8 timeout warn text","outcome":"fixed","path":"src/modules/host.ts","round":"1","fix":"753afdf0e"},{"id":"R6","role":"spec","class":"spec B6 troubleshooting section incomplete","outcome":"fixed","path":"website/src/content/docs/docs/worker/troubleshooting.mdx","round":"1","fix":"753afdf0e"},{"id":"R7","role":"spec","class":"spec I4 absolute paths and B unit","outcome":"fixed","path":"src/fseventsd/worker.ts","round":"1","fix":"753afdf0e"},{"id":"R8","role":"claims","class":"documentation 7 manual restates code","outcome":"fixed","path":"src/fseventsd/AGENTS.md","round":"1","fix":"753afdf0e"},{"id":"R9","role":"code","class":"testing 10 time boundary not straddled","outcome":"fixed","path":"src/modules/host-findings.test.ts","round":"2","fix":"3a160b0c8"}]}

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review November 18, 2026 19:57
@V3RON
V3RON merged commit fb42676 into main Nov 18, 2026
33 checks passed
@V3RON
V3RON deleted the task/1735 branch November 18, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fseventsd module: doctor warns when fseventsd uses over 2 GB on a macOS worker

1 participant