Skip to content

Slack: restart a conversation with "new" and replay its messages - #19

Merged
sadfun merged 1 commit into
sadfun:mainfrom
nocell:feat/slack-new-restart
Sep 22, 2026
Merged

sadfun merged 1 commit into
sadfun:mainfrom
nocell:feat/slack-new-restart

Conversation

@nocell

@nocell nocell commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

In Slack, @Wirebot new inside a thread and plain new in the bot DM now restart that conversation's Codex task, and the fresh task gets the conversation so far as context.

Mentioning the bot with /new already worked, but Slack's composer swallows a leading slash in DMs, and people naturally write @Wirebot new. More importantly, a restart used to throw away everything the thread had discussed: the new task started blind. Now the connector remembers the restart and, on the next ordinary message in that conversation, replays the messages posted before it — the thread's replies via conversations.replies, or in a DM the recent history via conversations.history — as the same plain-text Name: text prefix a first mention in an existing thread already uses (8,000-character budget, oldest dropped). The prefix says explicitly that the previous task's memory is gone and this is reference material. /wirebot new and @Wirebot /new gained the same carry-over.

Implementation

  • parseSlackCommand (moved to slack/message.ts) accepts /name args as before plus a small set of bare command words, currently just new; used both for dispatch and for keeping commands free of context prefixes.
  • SlackChannel keeps a bounded in-process map of restarted conversation keys → the new message ts; withRestartContext consumes it on the next message. formatThreadContext takes an optional beforeTs cut-off.
  • SlackMessagingApi gains fetchHistory(channel, latestTs, limit).
  • ChannelTraits.restartCarriesHistory lets the bridge's new confirmation mention the carry-over on connectors that do it (Slack only for now); Telegram and Discord behave exactly as before.
  • docs/slack.md documents the command and the in-process nature of the pending carry-over.

Testing

  • bun run check and bun test pass. Manually exercised the parser on the slash form, bare new with case/punctuation, and non-matches such as renew or what's new?, and the restart cut-off in formatThreadContext.

🤖 Generated with Claude Code

In Slack, "@wirebot new" inside a thread and plain "new" in the bot DM now
start a fresh Codex task for that conversation, alongside the existing
"@wirebot /new" and "/wirebot new". The connector remembers the restart and,
on the next ordinary message there, fetches the thread's replies (or, in a
DM, the recent conversation history) from before the restart and prefixes
them as plain-text context — the same format a first mention in an existing
thread already uses — so the new task knows what was discussed without the
previous task's memory. The bridge's confirmation says so on connectors that
carry history over.
@nocell
nocell force-pushed the feat/slack-new-restart branch from de9fccd to 2a14e1b Compare September 22, 2026 07:19
@sadfun
sadfun merged commit 299fab2 into sadfun:main Sep 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants