feat(gchat): option to keep threads in direct messages
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend
Research direction
Start in the Google Chat adapter's handleMessageEvent, where DM messages are mapped to a thread ID, and compare with how the Slack adapter's agentView handles DM thread roots. Check how the proposed threadedDMs flag would alter the :dm ID and whether openDM() subscriptions still match. Done means that with the option on, a new DM thread gets its own ID and reply, the default behaviour is unchanged, and the option name is settled with maintainers first.
Written by the indexing model from the issue text.
Description
Problem Statement
In a Google Chat direct message, the Google Chat adapter maps every message to one space-only thread ID (gchat:spaces/DM_SPACE:dm) and drops message.thread.name. A DM is therefore one endless conversation for the bot: replies always go to the top level, and a user who starts a new thread in the DM (Google Chat supports threads in DMs) still lands in the same conversation and memory as everything before it.
The Slack adapter handles this differently. In a Slack DM, a reply inside a thread keeps its thread_ts, so it stays a separate conversation, and agentView: true makes every top-level DM message its own thread root, while still routing to the openDM() subscription when that one is subscribed. Google Chat has no equivalent, so the same bot behaves differently on the two platforms.
We build internal agents for colleagues (one case = one thread) and work around this today by replacing the adapter's handleMessageEvent with a copy that keeps the thread name for DMs. That copy breaks with every adapter change.
Proposed Solution
An adapter option, for example threadedDMs: true (name open), with which a DM message is encoded with its thread name, like messages in spaces:
const threadName = isDM && !this.threadedDMs ? undefined : message.thread?.name || message.name;
with the :dm marker kept so thread.isDM stays true. Like Slack's agentView bridge, a message could route to the space-only ID when that ID has a subscription from openDM(), so proactive flows keep working.
Default stays as today, so nothing changes for existing users.
Alternatives Considered
- Overriding
handleMessageEventin our own code (what we do now): works, but depends on adapter internals. - Making thread-aware DMs the default: closer to Slack's default (thread replies keep
thread_ts), but changes behaviour for existing bots.
Use Case
import { createGoogleChatAdapter } from '@chat-adapter/gchat';
const gchat = createGoogleChatAdapter({
// ...
threadedDMs: true,
});
// A new thread in a DM -> its own thread ID, its own conversation and memory;
// the bot's reply goes into that thread instead of the top level.
Priority
Important
Contribution
- I am willing to help implement this feature
Additional Context
Related: #1135 (card clicks in a DM get a different thread ID than the DM's messages). With this option, a click and the messages of the same DM thread would both carry the thread name, which also removes the mismatch described there for threaded DMs.
The Teams adapter has no equivalent, but Teams 1:1 chats have no reply threads, so there is nothing to keep there.
- Dominant language
- TypeScript
- Stars
- 2.5k
- Forks
- 355
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 42
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
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.
More from vercel/chat
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
X and Twitch: paragraphs inside a block quote are joined with no spacePossibly taken @abhiramshaji-cyber claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 87/100
Maintainers usually reply within 1 day
-
🛠️ dette technique
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
betagouv/mon-entreprise#4752 · 1 comment ·
Maintainers usually reply within 5 days
-
type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
franciscoBSalgueiro/en-croissant#1111 ·
Maintainers usually reply within 2 days
-
area/providers type/feature version/v2
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
anomalyco/opencode#64845 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day