Skip to content

Feature: chat cannot see the organization's work — tasks, projects, conversations #2992

Closed

Description

@Israeltheminer

The report

A user asked chat about open project tasks. Chat recommended Asana, Monday.com and Jira — competitors to the product it is embedded in.

That is not a model failure. It is what the code does.

Three causes

1. rag_search has no work in it. The chat assistant's loadout is fixed at three tools (lib/chat/tools.ts), and rag_search (convex/chat/assistant_tools.ts) runs five legs: documents, crawled pages, knowledge entries, contacts, products, websites. There is no tasks leg, no projects leg, no conversations leg. A perfectly healthy knowledge base still answers nothing about the board.

2. The model does not know the product has projects or tasks. lib/chat/context.ts — the prompt assembler — contains zero occurrences of "task" or "project". The persona mentions Tasks exactly once, to push work away:

DELIVERABLES GO TO TASKS — … tell them briefly that this is task work, and to create a Task and assign it to an agent.

So the assistant is instructed to tell people to create a Task while being structurally unable to tell them whether one already exists. With retrieval empty and no product awareness, naming a competitor is the honest completion.

3. A project-bound chat does not know its own project. threads.projectId exists and is indexed, the project page has a Chats tab, and getProjectIdForThread / assertProjectAccessForChat are both built — but projectId appears nowhere in lib/chat/ or convex/chat/turn_action.ts.

Consequently projects.instructions is never read. The editor promises:

Every chat in this project starts with these instructions.

The field is validated, persisted and audited. Nothing consumes it.

Mostly a wiring gap, not a build

  • AGENT_TOOL_CATALOG already ships task_find and task_get, over tasks/internal_queries.listTasksForAgent and getTaskContextForAgent
  • tasks/internal_queries.listProjectsForAgent exists with zero callers
  • projects/internal_queries.getProjectForInjection — "Load a project record for chat-time injection" — also has zero callers; its referenced caller was removed in the AI-backend rewrite
  • conversations is the one genuine build: it has queries but no agent read, and its RLS is narrower than every other leg (assignment scope, not just org + role)

A retrieval problem underneath

rag_search passes the user's raw question to every leg, and the entity backends substring-match the entire phrase (convex/contacts/query_contacts.ts and equivalents). A leg therefore asks does any row contain this whole sentence? — so legs 2–5 cannot match a question and only fire when the message is itself a name fragment. Any new leg copied from them inherits this.

Scope

Boundary

lib/chat/tools.ts states the loadout as a product decision:

Chat is for questions and retrieval … Deliverables are produced on a Task assigned to an agent.

That rationale is about execution, not retrieval. Everything here is read-only, so it honours the boundary rather than widening it.

Loadout decision

The chat loadout stays at three tools. Depth arrives on the existing rag_fetch, not as a fourth tool.

Two reasons. Every tool's schema and description ship with every turn — rag_fetch's description alone is ~10 lines — so a fourth tool taxes the overwhelming majority of turns that never need task depth (#2980 exists because that budget is actively managed). And rag_fetch is already exactly this mechanism: "Load the full text behind a ref … a search hit is only a snippet." Search returns snippets plus refs; fetch loads what is behind a ref, with offset/limit windowing. Work items should use that pattern rather than get a bespoke one.

This changes the tasks/projects legs, and the change is load-bearing. The original design gave work rows no ref, on the model of contacts and products, which cannot be fetched. Shipping it that way would leave depth genuinely unreachable — there would be no ref for rag_fetch to accept. So the legs must mint refs for task and project rows, and rag_fetch grows a work-ref branch that resolves through getTaskContextForAgent (already built, currently no chat caller).

Whatever depth returns must honour the same access gates as the leg that produced the ref: holding a ref is not a capability, exactly as filterRetrievableRagFileIds enforces for documents today. A denied work ref must read as not_found, with a message byte-identical to a nonexistent one so no existence oracle leaks.

Note for anyone reading the loadout as a hard ceiling: three tests pin the three-element list, and they exist because ask_question was built and declined. This is the second tool declined the same way — the tests are doing their job and stay untouched.

Activity

  1. added
    priority: high
    feat
    service: platform
    epic
    on Aug 17, 2026
  2. larryro commented on Aug 18, 2026

    @larryro
    Contributor

    @Israeltheminer Agree with the rag_search legs for tasks, projects, and conversations — that plus prompt/product awareness is what stops chat from naming competitors when asked about the board.

    Keep the chat loadout at the existing three tools. Do not add task_get (or any other new chat tool). The reported failure is empty retrieval, not missing depth; task_get already lives on the agent catalog, and putting it on chat spends context for a case the search hits can already answer (title, status, assignee, project).

    If a later turn needs comments, blockers, or the full description, extend rag_fetch to accept a work ref the search hit already returned, rather than adding a fourth tool.

  3. Israeltheminer commented on Aug 18, 2026

    @Israeltheminer
    ContributorAuthor

    Agreed — dropping the fourth-tool path and building on what exists. The scope list and a new Loadout decision section above are updated to match.

    One thing worth flagging, because it would have quietly produced the outcome the fourth tool was meant to prevent: the legs as designed give work rows no ref. The original design followed contacts and products, which carry no ref and cannot be fetched. Ship that and "extend rag_fetch to accept a work ref the search hit already returned" has nothing to accept — depth would be absent by accident rather than by decision.

    So the restructure is:

    • legs — tasks and projects legs in rag_search, and unlike contacts/products they mint a ref per row
    • fetch — rag_fetch grows a work-ref branch, resolving through getTaskContextForAgent (built, no chat caller today). Loadout stays at three.
    • scope — a work ref carries no authority. The fetch re-checks access the same way filterRetrievableRagFileIds does for documents, and a denied ref answers not_found with a message byte-identical to a nonexistent one, so nothing leaks by existence.
    • rendering — the timeline-step work moves here from the cancelled fourth-tool item: the branch in app/features/chat/utils/activity-label.ts and a thinking.* key per locale, plus retuning searchingKnowledgeBase, which is wrong copy once work legs land. A work result is org state, not a citation, so it is not a source card.

    Unchanged: the conversations leg (still the highest-risk item, still needs passesAssignmentScope extracted into a predicate shared with rls_rules.ts), the project-bound thread injection, and migrating the existing contacts/products/entries legs onto the new matcher.

    Prerequisites #2983 and #2984 are both merged, so the legs are unblocked.

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

    epicfeatpriority: highservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions