Repository navigation
Conversation
The watcher selected projects from the config snapshot it was created with, so a project added later could stay unwatched. Re-read the current config on every selection. A watch attaches after the project's first scan; files copied before attachment produced no events. Once a new root is watched, run one project index pass before handling its event batches, retry a failed pass on the next cycle, and keep it pending while a restart is requested. Track projects by identity, not root, so a path change does not rescan an empty directory and delete the existing index. A reload waits for the catch-up drain so watchfiles does not discard buffered batches; startup projects keep their existing initial scan and are not scanned twice. Fixes basicmachines-co#1817 Signed-off-by: TPSJASPER <592827953@qq.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Fixes #1817
A project created in an empty folder is watched only after the next project reload. Files copied into it before that reload produce no watch events, so they stay unindexed until they change,
bm reindexruns, or the server restarts. The watcher also filtered projects with the config snapshot it was created with, so a project added later could stay unwatched even after a reload.What changed
_select_projects_to_watchre-reads the currentConfigManagerconfig and keeps the existing locally-syncable and constrained-project rules.WatchServicetracks projects it has finished catching up by project external id, not by root path. Startup projects register from their existing initial scan.bm project moverewrites the path before the user moves the files, so scanning the still-empty root would plan every old path as deleted and remove the project's index.The
bm-projectmanual page describes the new-project catch-up pass.Validation
tests/indexsuite on SQLite: 210 passed, 10 skipped, 1 deselected.bm_project, copies a nested Markdown file before attach, and finds it withbm_search.ruff check,ruff format --check,ty checkfor the changed files, andgit diff --checkpassed.doctor --localcompleted sandboxed write, index and search in an isolated config directory.The full-repository
ty checkstill reports the same 8 environment diagnostics as the unmodified baseline (optionalpymilvus/uvloop, Windowsresourcemembers); no ignores were added. The full test suite and Postgres tests were not run. The implementation was also replayed againstorigin/mainwithgit apply --check.Risks / rollback
The catch-up runs once per newly seen project identity after attachment; files written during the pass are still delivered by watch events. Startup still relies on its existing background initial scan rather than a second pass. Revert the commit to roll back.