Repository navigation
fix(platform): answer board questions by listing, not only by matching - #3008
Merged
Merged
Conversation
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.
This was referenced Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_fetchon a project ref four times. Each call returnedinvalid_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
sourcesreportslistedrather thansearched, so the model never reads a list as "these matched your words".updatedAtnewest-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.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.sourcessays the rows are the most recently updated ones in scope, not the whole set.rag_fetchon a project ref returns that project's tasks, each with its own task ref so depth is one more fetch away.searchTasksForChattakes an optionalprojectIdto narrow to one project.assigneeUserIdandassigneeTeamId, and marks an unassigned conversation asunassigned.Not solved with a denylist of words like
taskandproject. 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.
projectIdfilters 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_fetchrequires the id to be in this turn'saccess.projectIds(chat/assistant_tools.ts:911). A ref quoted from an earlier turn, after access changed, returnsnot_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
updatedAtdescending, 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,sourcessays 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:
projectIdwiden scopeScope
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.tsxfilters any attachment carrying both acontentIdand aurlas 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.