Skip to content

perf(platform): bound the knowledge scopes' readable projects #5202

Closed

Description

@tale-code-bot

Split from #5193, which was split from #5156 (item 4 of 7 of #4708). The change for #5193 (TALE-283, branch perf/join-readable-projects-readers, on its way to feature-train) joins readableProjectsSql in the document search, the create-task fallback and the chat hand-over; this issue takes the knowledge access scopes.

What the reads do now

Two scopes read every project the caller may read with listProjects and hand the id list to the knowledge database:

  • callerScope in services/platform/backend/domains/knowledge/routes.ts (active projects);
  • the knowledge scope in services/platform/backend/domains/chat/shim.ts (archived projects included, and their ids again as archivedProjectIds), which the chat tools, the MCP door and the sandbox bridge resolve.

The knowledge database filters by that list (d.project_id = ANY($n) in backend/core/knowledge/corpus.ts). It cannot join app.projects, so readableProjectsSql does not reach it as things stand.

What to do

  • Decide and record a design that bounds what crosses to the knowledge database. Two starting points: hand the knowledge read the caller's audience (admin, teams, a key's project) and resolve the readable projects where the documents' project is known; or send only the readable projects that hold indexed documents.
  • Keep each scope's rule for archived projects.

Done means:

  • neither scope reads an unbounded project list, and neither sends the caller's whole project-id list as ANY(<ids>);
  • tests cover the visibility rules (PROJ-R1, PROJ-R2) for both scopes.

Activity

  1. added
    agent-ready
    on Oct 31, 2026
  2. tale-code-bot commented on Oct 31, 2026

    @tale-code-bot
    CollaboratorAuthor

    Split while working this issue (TALE-287). The change for this issue makes two changes:

    • it bounds both knowledge scopes to the readable projects that hold a document, in one statement through readableProjectsSql;
    • it checks a single project with readableProjectsAmong.

    The chat tools' work legs (tasks and projects search and listing) also took the full readable list from the chat knowledge scope. Their part is filed as #5207. Until #5207 lands, those legs read their list through their own query, unchanged.

  3. added a commit that references this issue on Oct 31, 2026
    24a18a9
  4. added
    perf
    on Oct 31, 2026
  5. tale-code-bot commented on Oct 31, 2026

    @tale-code-bot
    CollaboratorAuthor

    Landed on release/0.6 with feature train #5221 (merged by rebase on 2026-10-31 at 20:26:51 UTC) as commit f5ac166 (perf(platform): bound the knowledge scopes' readable projects). It ships with Tale 0.6.0. GitHub closes issues only for commits on main, so the feature-train role closes this one. Task: TALE-287.

  6. 21 remaining items

  7. added 11 commits that reference this issue on Nov 4, 2026
    7a91902
    67553ee
    12eebd5
    2e11741
    eeb5433
    b07500d
    48b9a2e
    03d0e61
    1f9ac87
    e70071c
    5fd9262
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyperf

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions