Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/brainlayer/mcp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,8 +1005,10 @@ async def _brain_search(
):
"""Unified search dispatcher — routes to the right internal handler."""

# Auto-scope project from CWD if not provided and not "all"
if project is None:
# Auto-scope project from CWD if not provided — but ONLY for claude_code source.
# Non-claude_code sources (youtube, whatsapp, etc.) have null/different project values,
# so auto-scoping filters them out entirely (bug: brain_search(source="youtube") → 0 results).
if project is None and source not in ("youtube", "whatsapp", "telegram", "all"):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fragile negative source list breaks future source types

Medium Severity

The project auto-scope bypass uses a negative list (source not in ("youtube", "whatsapp", "telegram", "all")) instead of a positive list. The PR description states the intent as "skip project auto-scope for non-claude_code sources," but the implementation only skips for three hardcoded sources plus "all". Any future non-claude_code source (or existing ones like "claude_desktop") that has null/different project values would still get auto-scoped, silently returning 0 results — the exact same bug this fix aims to prevent. Using source in (None, "claude_code") would match the stated intent and default to the safe behavior (no auto-scoping) for unknown sources.

Fix in Cursor Fix in Web

try:
from ..scoping import resolve_project_scope

Expand Down
Loading