Skip to content

fix(platform): answer board questions by listing, not only by matching - #3008

Merged
Israeltheminer merged 4 commits into
mainfrom
feat/chat-work-enumeration
Aug 19, 2026
Merged

Israeltheminer merged 4 commits into
mainfrom
feat/chat-work-enumeration

Conversation

@Israeltheminer

@Israeltheminer Israeltheminer commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Chat can now answer "are there any open tasks?" and "which tasks are on this project?". Both returned nothing before, or worse, an accidental match.

Why

Found while verifying #3002 through #3007 on a live deployment.

Board questions matched nothing. "Are there any open tasks?" tokenises to open, tasks, projects. No task title contains those words, so the leg matched nothing. Correctly, and uselessly.

What surfaced instead was a project whose description reads "A starter project to explore tasks and your agents". The word "tasks" matched. So the answer was decided by which project happened to have a query word in its prose. That reads as an answer while being an accident, which is worse than an empty result. It is also why a project named "Tale Issues" appeared when named and vanished when the question said "projects".

Project refs refused. A turn called rag_fetch on a project ref four times. Each call returned invalid_args. The refusals consumed its whole step budget. A project row says "8 open tasks" and there was no way to ask which ones. The model was reaching for the right thing and I had blocked it.

Conversations withheld the assignee. Asked "what team is this assigned to", chat found the conversation and could not say.

What changed

  • The tasks and projects legs list what is in scope when the wording matches nothing. sources reports listed rather than searched, so the model never reads a list as "these matched your words".
  • Both listings walk updatedAt newest-first, so the 15-row cap keeps the most recently touched work. The org index yields oldest-first, which would have answered "what is open?" with the most stale tasks on the board.
  • Both run through paginateWithFilter, which bounds rows examined as well as rows kept. A caller who can read few projects rejects most of what it walks, and an unbounded walk would read the whole tasks index.
  • When that budget stops the walk, sources says the rows are the most recently updated ones in scope, not the whole set.
  • rag_fetch on a project ref returns that project's tasks, each with its own task ref so depth is one more fetch away.
  • searchTasksForChat takes an optional projectId to narrow to one project.
  • The conversations leg returns assigneeUserId and assigneeTeamId, and marks an unassigned conversation as unassigned.

Not solved with a denylist of words like task and project. Those appear in real names: "Tale Issues" is found by "issues". Stripping them would make named things unfindable.

Risk

Narrowing to one project cannot widen scope. projectId filters the caller's readable list (tasks/search_for_chat.ts:134). It never adds to it. Naming a project the caller cannot read leaves the set empty, so the result is empty.

A project ref is re-checked on the turn it is fetched. rag_fetch requires the id to be in this turn's access.projectIds (chat/assistant_tools.ts:911). A ref quoted from an earlier turn, after access changed, returns not_found. A malformed id returns the same thing, so neither answer reveals whether the project exists.

The listing and the search decide scope with the same code. Both call taskAllowed (tasks/search_for_chat.ts:57). A later change to project visibility reaches both paths or neither.

A listing is bounded twice, and says so. Both legs walk updatedAt descending, keep 15 rows, and examine at most 500. The tasks page is then grouped by status and rank. On a board over the cap the answer is the 15 most recently touched tasks. When the scan budget ends the walk, sources says the rows are not the whole set, so a partial listing is never presented as the board.

Tests

20 at the query layer through convex-test, plus chat-level coverage of the reporting and the project fetch. Three seed 20 rows against a cap of 15 and assert which 15 survive, in both legs. Three more seed 600 unreadable rows and assert the walk stops at its budget without claiming the board is empty.

Mutations, all red:

  • removing the listing fallback
  • letting the listing ignore the readable set
  • letting projectId widen scope
  • skipping the project-ref scope re-check
  • reporting a listing as a match
  • dropping the assignee from the wire
  • walking either listing oldest-first
  • dropping the descending order
  • dropping the status/rank grouping
  • removing the scan budget
  • claiming a budget-stopped listing is complete, in either leg
  • reporting a partial listing as the whole set

Scope

Does not touch retrieval scope, the archived labelling, or the privacy rule.

Two problems from the same verification session are not in here. Email attachments are stored but hidden in the Inbox, because message.tsx filters any attachment carrying both a contentId and a url as an inline image. And email attachments are still not indexed for RAG, which was a deliberate choice in #2995. Both are being handled separately.

Gate: typecheck, oxlint --type-aware, oxfmt, SAST 0 findings, migrations:check (no migration), platform 75,180 tests.

Israeltheminer and others added 4 commits August 19, 2026 09:47
Asked "are there any open tasks?", chat found none and said so. The words
tokenise to open/tasks/projects, no task title contains them, and the leg
correctly matched nothing. What surfaced instead was a project whose DESCRIPTION
happens to read "A starter project to explore tasks and your agents" — the word
"tasks" matched. That reads as an answer while being an accident of prose, which
is worse than an empty result.

The tasks and projects legs now fall back to listing what is in scope when the
wording matches nothing, and `sources` says which of the two happened so the
model never reads a list as "these matched your words".

Not solved with a denylist of words like task and project: those appear in real
names — a project called "Tale Issues" is found by "issues" — so stripping them
would make named things unfindable.

`rag_fetch` on a project ref now returns that project's tasks. It used to refuse
with invalid_args, and a real turn was observed calling it four times and
spending its whole step budget on the refusals. The model was reaching for the
right thing: a project row says "8 open tasks" and there was no way to ask which.
Each returned task carries its own ref, so depth is one more fetch away. The
project must still be in the caller's readable set on this turn.

`searchTasksForChat` takes an optional `projectId` to narrow to one project. It
intersects with the readable set rather than replacing it, so naming a project
can never widen scope.

The conversations leg returns the assignee. Asked "what team is this assigned
to", chat could find the conversation and could not say — the assignment is the
field this leg's whole privacy rule is built on, and it was withheld from the
answer. An unassigned conversation is marked as such, because triage state is
something an admin acts on rather than missing data.
"Are there any open tasks?" answered with the 15 stalest tasks on the board.
Both listings are capped at 15 and walked `by_organization`, a single-field
index that yields rows oldest-first, so the cap kept the least recently
touched work and then sorted it convincingly by status and rank.

Both legs now walk `updatedAt` descending, matching the org-wide task listing
in `queries.ts:647`. `updatedAt` is required on `tasks` and `projects`, and
both org+`updatedAt` indexes already exist, so nothing changes in the schema.
The tasks page keeps its status-then-rank grouping after the cap, so a model
still reads it the way the board reads.

Three tests seed 20 rows against the cap and assert which 15 survive, in both
legs, plus one proving the status grouping still applies when recency order
and status order disagree.
Both listings filtered as they walked and stopped at 15 kept rows, with no
bound on rows EXAMINED. A caller who can read few projects rejects almost
everything it walks, so one board question could read the organization's whole
tasks index.

They now run through `paginateWithFilter`, the existing helper for a
heavily-filtered listing: it bounds rows examined at 500 and tracks a resume
cursor. The hand-rolled loops were a second copy of that.

A bounded walk can also stop before the index ends, and the leg reported
"these are the tasks in scope" either way. The source line now follows
`isDone` and says the rows are the most recently updated ones in scope, not
the whole set, the way the conversations leg names its own bound.
@Israeltheminer
Israeltheminer merged commit fcb090d into main Aug 19, 2026
50 checks passed
@Israeltheminer
Israeltheminer deleted the feat/chat-work-enumeration branch August 19, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant