feat: Phase 1+2 Background Autonomy — FS Watcher + Continuous Learning Pipeline#2
Conversation
- FileWatcher class: chokidar v5 wrapper, two-layer noise filter - Ignores: node_modules, dist, .git, logs, tmp, coverage - Watches: ts, js, md, txt, prompt files - 5 new Vitest tests; 48 total passing - Wired into server init via RuntimeLogger + CommandCenterDashboard Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6402966787
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| /** Paths and patterns passed to chokidar `ignored` option (AUTO-02). */ | ||
| const CHOKIDAR_IGNORE: (string | RegExp)[] = [ | ||
| "**/node_modules/**", |
There was a problem hiding this comment.
Replace unsupported glob-string ignore matchers
This package locks Chokidar 5.0.0, where string ignored matchers compare exact paths rather than interpreting glob syntax, so patterns such as **/node_modules/** never match. The later in-process filter suppresses emitted events, but Chokidar still recursively scans and watches .git, node_modules, dist, and coverage, causing substantial startup/resource usage and potentially exhausting file-watch handles on normal large repositories. Use function, regex, or recursive path matchers supported by Chokidar v5.
Useful? React with 👍 / 👎.
| this.inner.on("unlink", (filePath) => this.emitChange("unlink", filePath)); | ||
| this.inner.on("error", (err: unknown) => { | ||
| RuntimeLogger.error("[FileWatcher] Watcher error", err); | ||
| this.emit("error", err instanceof Error ? err : new Error(String(err))); |
There was a problem hiding this comment.
Avoid re-emitting watcher errors without a listener
When Chokidar reports an operational error such as an exhausted watch limit, this re-emits Node's special error event, but the server integration in src/index.ts registers only a change listener. An error event without a listener throws synchronously and terminates the MCP server, so a recoverable watcher failure becomes a full service crash; either handle the event at integration or do not re-emit it after logging.
Useful? React with 👍 / 👎.
|
|
||
| // AUTO-02: segment-level noise filter | ||
| for (const seg of NOISE_PATH_SEGMENTS) { | ||
| if (normalised.includes(`/${seg}/`) || normalised.includes(`/${seg}`)) { |
There was a problem hiding this comment.
Match exact relative path segments before filtering
This prefix-style check rejects meaningful files whose path merely starts with a noise-segment name, and it also checks parent directories outside the watched root because Chokidar supplies absolute paths. For example, every event under /workspace/distribution-app, any repository located below /tmp/dist, and a valid file such as /repo/src/coverage-helper.ts is silently discarded. Compute the path relative to rootPath and reject only exact directory segments.
Useful? React with 👍 / 👎.
…sponses, core refinements Prior audit session (F-01 through F-08) left code fixes unstaged. Includes semantic-provider.ts, structured-response.ts, and updates to config, dashboard, server, history, lesson extraction, and refiners. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…TO-03/04 - GitPoller (src/history/git-poller.ts): polls CommitIngester.ingestLatest every 30s in production; emits commits event when new commits detected (AUTO-03) - BackgroundAutonomyService: wires GitPoller via optional gitPollIntervalMs param (null = disabled, safe for fake-timer tests); server.ts passes 30_000 (AUTO-04) - 8 new tests in git-poller.test.ts: poll/event/error/start/stop/idempotent - 122/122 tests green Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Test plan
Generated with Claude Code