Skip to content

SqliteStore::query_nodes content_contains branch drops node_type, ids, and title filters — a content search scoped to a type or collection returns nodes of every type #2212

Closed

Description

@mstomar125

Summary

When NodeQuery.content_contains is set, query_nodes returns early with 'SELECT * FROM node WHERE LOWER(content) LIKE ?1 [LIMIT/OFFSET]' (nodes.rs:949-969), ignoring query.node_type, query.ids, and query.title_contains entirely, even though NodeService::query_nodes passes all of them through together (query.rs:56-65), query_nodes_simple's own docs promise 'content_contains + optional node_type' composition (query.rs:267), and ops::query_nodes lets callers combine node_type with a content-contains filter; nothing downstream re-applies the dropped node_type/title conditions (the ops layer re-checks only collection membership).

Failure scenario

Agent calls query_nodes {node_type:"task", filters:[{field:"content", operator:"contains", value:"meeting"}]}. The store runs a content-only full-table LIKE and returns text notes, date pages, and collections containing 'meeting'; nothing filters them out, so the tool's output — which the model then presents to the user as their matching tasks, with a count — includes non-task nodes and a wrong count. The same call scoped to a collection also loses the type constraint (membership is re-checked in memory, node_type is not), and a query combining title-contains with content-contains silently discards the title condition.

Location

packages/core/src/db/sqlite_store/nodes.rs:949

Severity

important


Found via a full-repo adversarial bug sweep, independently verified by two separate skeptical reviewers reading the actual current code before filing.

Activity

  1. self-assigned this
    on Aug 21, 2026
  2. mstomar125 commented on Aug 28, 2026

    @mstomar125
    ContributorAuthor

    Frontend baseline: 4794 passed (227 test files), 0 failed. Starting combined fix with #2211 (same query_nodes function).

  3. self-assigned this
    on Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions