CopilotKit / CopilotKit/outpost
Pass message author identity into the AI conversation history
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7
- Forks
- 3
- Avg merge
- 7d 16h
- Merged PRs (30d)
- 15
Description
The support bot cannot tell who is speaking in a thread. This is the direct cause of the second incident behind #172: a maintainer asked a community member a follow-up question, and the bot answered the maintainer, explaining in its reply that it "can't see other users' replies."
It was telling the truth. It can't.
Where
packages/outpost/queue/src/handlers/ai-response.ts, building conversationHistory:
const conversationHistory = ticket.messages
.filter((m) => m.type !== 'SYSTEM' && m !== openingUserMessage)
.map((m) => ({
role: (m.type === 'USER' ? 'user' : 'assistant') as 'user' | 'assistant',
content: m.content,
}));
Every non-SYSTEM message collapses to a bare user or assistant role derived from Message.type alone. Message.author is discarded. So the reporter, a maintainer, and an unrelated third party all arrive at the model as indistinguishable user turns.
Why it's worth doing
Message.author is already populated on every row — InboundHandler writes "${platformUsername} (${platformUserId})" for every platform. The data exists and is simply never handed to the model. This is a small change.
It also matters more now, not less. #172 caps the bot at one response per ticket, so the single answer it does write has to be right. Handing it a conversation where it cannot distinguish "the maintainer already solved this" from "the customer is still asking" is exactly the input that produced the incident.
Considerations
- Deciding the shape matters more than the code. Options include prefixing content with the author, using the
namefield on message parts where the provider supports it, or passing a structured participant list alongside the history. Worth one deliberate decision rather than the first thing that works. - Team membership is already computable (
isTeamMemberinInboundHandler) and is the distinction that matters most: "a maintainer has spoken here." That overlaps with the human-presence gate work, so the two are worth designing together. - Author strings are user-controlled on most platforms. Whatever format is chosen should not let a display name masquerade as a role marker in the prompt.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/outpost/queue/src/handlers/ai-response.ts at conversationHistory, then inspect InboundHandler where Message.author and isTeamMember are populated. Decide and document a safe way to preserve author identity and maintainer participation without allowing user-controlled names to act as role markers. Done means the model can distinguish participants and team presence in the conversation history.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100