Skip to content

fix(core): warn when the watcher cannot read a new directory - #1692

Merged
phernandez merged 6 commits into
mainfrom
salvage/1686-warn-unreadable-dir
Oct 9, 2026
Merged

phernandez merged 6 commits into
mainfrom
salvage/1686-warn-unreadable-dir

Conversation

@phernandez

Copy link
Copy Markdown
Member

Supersedes #1686 by @sammywachtel. The commit is cherry-picked unchanged, with authorship and sign-off kept, so the full CI suite runs: fork PRs skip it.

When a new directory can't be read, the watcher can't add a watch on it, and notify drops that error. Files written into the directory are then never indexed. The new warn_unreadable_new_directories() runs on each batch's added directories and logs one warning naming the directory and bm project index <name>. This is the smaller change suggested when #1664 was declined. See #1686 for the full write-up.

Added on top: a changelog entry under v0.24.0 Bug Fixes.

Verification: just fast-check is clean, and just fast-test tests/index/test_watch_service.py passes (5 tests).

🤖 Generated with Claude Code

https://claude.ai/code/session_01APFUk2bjEwMptMQqpRhjea

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 629b2b04a6

ℹ️ 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".

Comment thread src/basic_memory/index/watch_service.py Outdated
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T02:36:30.431248Z 7881385 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6887ee6ad2

ℹ️ 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".

Comment thread src/basic_memory/index/watch_service.py Outdated
@phernandez phernandez added this to the v0.24.0 milestone Oct 9, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1e206136b9

ℹ️ 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".

Comment thread src/basic_memory/index/watch_service.py Outdated
sammywachtel and others added 5 commits October 8, 2026 21:24
On Linux the watcher adds a watch on a new directory when it appears.
If the directory cannot be read at that moment, adding the watch fails
and notify discards the error. Files written into the directory then
produce no events and are never indexed, and nothing is logged.

The directory's own creation event still arrives, because the parent's
watch is fine. When a batch reports a new directory that cannot be
listed, log a warning that names it and says to run
`bm project index <name>` (or `bm reindex`) once its permissions are
fixed.

Signed-off-by: sammywachtel <subp@wachtel.us>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APFUk2bjEwMptMQqpRhjea
Signed-off-by: phernandez <paul@basicmachines.co>
`bm project index My Notes` parses as two arguments and fails. Render
the recovery command with shell_command so a project name with a space
or shell metacharacter survives copy-paste.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APFUk2bjEwMptMQqpRhjea
Signed-off-by: phernandez <paul@basicmachines.co>
…-safe

The watcher also watches a cloud project's local bisync copy, and the
local reindex refuses cloud projects, so `bm project index` was the
wrong remedy there (test_remedy_emission_sites caught it once the hint
went through shell_command). handle_changes now passes whether the
project is local, and a cloud project gets a permissions hint instead.

The path and project name were embedded in an f-string while keyword
arguments were also passed, so Loguru ran str.format over them: a
directory named "{foo}" raised KeyError and dropped the whole batch.
They are now Loguru arguments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APFUk2bjEwMptMQqpRhjea
Signed-off-by: phernandez <paul@basicmachines.co>
…ry hint

The hint looked the mode up in the watcher's startup config snapshot, so
a project switched with `bm project set-cloud` mid-cycle still got the
local `bm project index` remedy, which refuses cloud projects. Read it
from current config, as _project_is_configured already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APFUk2bjEwMptMQqpRhjea
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez
phernandez force-pushed the salvage/1686-warn-unreadable-dir branch from a24d196 to 62a55a1 Compare October 9, 2026 02:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 62a55a1397

ℹ️ 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".

Comment thread src/basic_memory/index/watch_service.py Outdated
…he hint

Shell quoting cannot stop Typer reading `-foo` as an option, so the
pasted remedy for a project named `-foo` failed with "No such option".
The hint now renders `bm project index -- -foo` for such names; other
names are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APFUk2bjEwMptMQqpRhjea
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez
phernandez merged commit 2c664fc into main Oct 9, 2026
34 checks passed
@phernandez
phernandez deleted the salvage/1686-warn-unreadable-dir branch October 9, 2026 02:58
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.

2 participants