fix(create-thread): unarchive thread after creation so it lands in author's Inbox#178
fix(create-thread): unarchive thread after creation so it lands in author's Inbox#178jgalea wants to merge 1 commit intoDoist:mainfrom
Conversation
…thor's Inbox Twist auto-archives newly-created threads for the author, which means threads created by an agent (running as the user) never appear in the user's Inbox. The user has to find them via the channel view or URL, which makes agent-driven posts feel invisible. Call inbox/unarchive immediately after threads/add to put the new thread in the author's Inbox alongside everyone else's. Wrap in try/catch — unarchive failure is non-fatal, the thread itself was created successfully and recipients still get notified.
|
@jgalea Whilst I understand the reasoning behind this PR ( believe me I do 😄), I'm relcutant to change the default (read: expected Twist) behaviour here. Perhaps we can have some middle ground where we have an option |
|
Thanks Scott, fair call. Default-preserving with opt-in is the right move, and the symmetry with the Twist CLI option pattern works well. I'll restructure as:
Quick question on the default override: your CLI exposes both a per-call option and a settable default. For this MCP, would you prefer (a) just the per-call parameter, or (b) per-call + an env var (e.g. I'll push the revision once you've picked. |
Actually, I think providing an environment variable would be fine, especially for those running the MCP locally. Just note that for the remote MCP, this value will be unset, so if you're using the remote MCP, you will not be able to set the default. Be sure to keep the README updated with the environment variable so that it can be surfaced for other users, with a note explicitly saying that the variable is only for running it locally, and the remote MCP will not have the default value set. |
Problem
Twist auto-archives newly-created threads for the author. When
create-threadis called by an agent (or any client running as a user), the thread never appears in that user's Inbox by default — they have to find it via the channel view or URL.This makes the existing tool behavior surprising for anyone using this MCP to drive an agent that posts on the user's behalf — the user never sees their own outgoing posts in their Inbox alongside everyone else's.
Fix
After
client.threads.createThread(...), callclient.inbox.unarchiveThread(thread.id)so the new thread lands in the author's Inbox alongside the recipients'. Wrapped in try/catch — unarchive failure is non-fatal, the thread itself was created successfully and recipients still get notified.Also updates the trailing user-facing note from "Threads you create do not appear in your own Inbox by default…" to a confirmation that it's now there.
Tests
Snapshots updated for the two
create-threadtest cases. All 156 tests pass.Notes
client.inbox.unarchiveThreadwas already exposed in@doist/twist-sdk(used elsewhere in the codebase).