Skip to content

perf(platform): join readable projects in the chat tools' work legs #5207

Closed

Description

@tale-code-bot

Split from #5202 (TALE-287), which was split from #5193 (#5156, item 4 of 7 of #4708).

What the reads do now

The chat tools' work legs read every project the turn user may read. They then hand that id list back to the app database:

  • workAccess() in services/platform/backend/core/chat/assistant_tools.ts reads the list through projects/internal_queries:resolveWorkProjectsForChat. That is resolveWorkProjects in services/platform/backend/domains/chat/shim.ts, which calls listProjects(…, { includeArchived: true }).
  • In a personal thread, the tasks and projects legs pass the whole list as projectIds to tasks/search_for_chat:searchTasksForChat and searchProjectsForChat. Those filter with t.project_id = ANY(${readable}) and id = ANY(${args.projectIds}).
  • The task listing checks a named projectId against the list.
  • The archive labels of the results come from the same list (archivedProjectIds).

Until #5202, this list came from the knowledge scope (resolveAccessScope). The change for #5202 bounds the knowledge scope to the readable projects that hold a document. It also moves this read, unchanged, to its own query, which reaches release/0.6 with it.

What to do

  • In a personal thread, join readableProjectsSql (backend/domains/projects/service.ts) in the two search handlers, from the turn user's auth, instead of taking the id list. TALE-283 did this for the document search.
  • A project thread keeps its one checked project.
  • A named projectId is checked on its own (readableProjectsAmong, or assertProjectAccessForChat).
  • Label archived projects from the result rows: a project row carries archivedAt, and a task's project can go through getProjectLabelsForOrg. Do not take the labels from a list.
  • Remove resolveWorkProjectsForChat and resolveWorkProjects.

Done means:

  • no chat work leg reads an unbounded project list or sends it as ANY(<ids>);
  • the tasks and projects legs return the rows they returned before, with the same archive labels;
  • tests cover the visibility rules for the tasks and projects legs: PROJ-R1, and PROJ-R2 with a disabled seat included.

Activity

  1. added
    agent-ready
    on Oct 31, 2026
  2. added
    perf
    on Oct 31, 2026
  3. added a commit that references this issue on Nov 2, 2026
    10d405f
  4. tale-code-bot commented on Nov 2, 2026

    @tale-code-bot
    CollaboratorAuthor

    Done on the feature line: feature train #5297 landed on release/0.6 by rebase at 2026-11-02 09:37:43 UTC. This issue's change is commit 0b97a0a5a447e63e85b28e0de97a31c0edd7d6b4 (perf(platform): join readable projects in the chat tools' work legs) on release/0.6, and it ships with Tale 0.6.0. GitHub closes issues itself only for commits that reach main, so the feature-train role closes this one now. Board task: TALE-293.

  5. 15 remaining items

  6. added 11 commits that reference this issue on Nov 4, 2026
    4e99646
    12eebd5
    7724c7c
    eeb5433
    d060918
    48b9a2e
    5adbc34
    1f9ac87
    54f9f02
    5fd9262
    52dbce2
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