Skip to content

fix(discord-bot): stream T3 replies into Teams group-chat mirrors and name weekly threads - #686

Merged
patroza merged 1 commit into
fork/devfrom
fix/teams-groupchat-mirror-replies-and-names
Nov 27, 2026
Merged

patroza merged 1 commit into
fork/devfrom
fix/teams-groupchat-mirror-replies-and-names

Conversation

@omegent-app

@omegent-app omegent-app Bot commented Nov 27, 2026

Copy link
Copy Markdown

Why

Production feedback on this week's Empasa group-chat thread:

  • T3 replies only reached the internal Teams mirror thread after someone @mentioned the bot there.
  • The Discord thread was named after the passive-chat prompt ("This Teams group chat is passive…") and opened in #omegent-alerts instead of the project channel.
  • The Discord thread echoed the whole internal prompt for every chat message.
  • Every mention posted another "Omegent Info" card.
  • The agent saw a fake attachment "Omegent", which was the mention left in Teams' HTML copy of the message.

What

  1. Mirror streaming. After each weekly group-chat turn, the gateway bridges T3 output into the Teams mirror thread through the same path a mention uses.
    • It uses a system mirror lease, system:group-chat-mirror. No Teams activity can carry that actor, so the lease only delivers output for a thread the gateway started.
    • The lease is persisted and restored like channel leases, and it is idempotent per conversation and T3 thread.
  2. Names.
    • Group-chat rules get an optional title, which wins over the missing activity title.
    • New weekly T3 threads get an explicit title, Teams: <title> · week YYYY-MM-DD (no auto-title). The guest's Discord title sync then shows it.
  3. "from unknown@teams" is left as is: sourceHint.actor feeds identity-map attribution, so it is not display-only.
  4. One info card per mirror. The mirror conversation gets its own link row, <weekly>#teams-mirror, so upsertThreadInfo finds the existing card.
  5. No fake attachment. <at> mention markup is removed before comparing Teams' HTML copy with the text. Quoted replies still resolve.
  6. Per-chat Discord channel.
    • Resolution order: rule discordChannelId, then workspace scannerDiscordChannelId (built-in scanner chats), then discord.alertsChannelId.
    • Threads that already exist this week are reused.
  7. Quieter Discord thread. The guest bridge doesn't echo gateway-originated T3 user messages on weekly group-chat links. The gateway's **Author:** text line is the record. Discord-typed and T3-web input still echo.

Ops

  • Add title and discordChannelId per pinned chat (aaaomega/ops#215).
  • The workspace needs exactly one enabled binding for the mirror channel.
  • Restart after the workspace config change.

Tests

discord-bot: 91 files / 1064 tests; typecheck and vp check clean.

🤖 Generated with Claude Code

… name weekly threads

Watched Teams group chats only got T3 output in their Teams mirror thread after
someone mentioned the bot there, and each mention posted another Omegent Info
card because the mirror thread had no link of its own. The weekly T3 thread
took its title from the passive-chat prompt, so the Discord thread read
"This Teams group chat is passive...", and the guest bot echoed every gateway
observation a second time.

- After a group-chat turn, the gateway bridges the weekly T3 thread into the
  mirror thread through a delivery-only lease on the mirror channel's binding.
  The lease shares the mention lease's reference key, so it is restored after
  restarts and a later mention reuses it.
- Mirror threads get their own delivery link, keyed by the Teams conversation,
  so the info card, stream tips and delivered answers persist per conversation.
  Restore now looks links up by conversation.
- Group-chat rules take an optional `title` and `discordChannelId`; workspaces
  take `scannerDiscordChannelId` for the built-in scanner chats.
- The weekly T3 thread is created with the title
  "Teams: <chat> · week <date>".
- The guest bridge no longer echoes Teams-sourced user messages in weekly
  group-chat Discord threads.
- The `<at>` mention in Teams' HTML copy of a message is no longer reported as
  attachment text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@patroza
patroza merged commit c5d5ad5 into fork/dev Nov 27, 2026
18 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.

1 participant