Skip to content

IM: Sync missed messages when switching from web/app to IM #93

@FridayLiu

Description

@FridayLiu

Problem

When a user interacts with a session on web/app and then switches to IM (Feishu/DingTalk group or P2P temp session), the IM channel has no visibility into what happened on the other client. The user loses context and cannot seamlessly continue the conversation.

Trigger Scenarios

  1. First join — user creates/joins a group for a session that already has web/app history
  2. Re-focus — user sends a message in IM after having interacted via web/app (the IM missed those intermediate messages)

Possible Approaches

Option A: Sync messages until last user input

Replay the messages that IM has not seen, up to and including the last user input and its AI response. This gives the user a complete view of recent conversation state.

  • Pro: Full context, no information loss
  • Con: May flood the chat for long conversations; needs truncation strategy (e.g. last N user turns)

Option B: Summary digest

Send a concise summary card describing what happened since the IM last interaction — key decisions, tool actions taken, files changed, etc.

  • Pro: Clean and compact, works well for very long histories
  • Con: Lossy — details may be missed; requires summarization logic (possibly LLM-based)

Option C: Hybrid

Sync the last few user turns in full, and provide a brief summary for anything older.

  • Pro: Balances completeness and readability
  • Con: More complex to implement

Scope

Applies to all IM adapters:

  • Group-based: Feishu, DingTalk
  • P2P-based: Teams, Telegram, WeCom

Open Questions

  1. How to handle the last turn if it is still in-progress (streaming)? If the AI is actively responding when the user switches to IM, should the sync wait for completion, show a partial snapshot, or skip the in-progress turn entirely?

  2. How to detect "re-focus" reliably? Unlike first join (which has a clear trigger), re-focus is implicit. Possible signals:

    • User sends a new message in IM after a gap (compare timestamp of last IM interaction vs. last session activity)
    • Ping message from Issue IM: Send ping message to existing group when re-selecting a session #92 could double as a re-focus trigger
    • Periodic polling (expensive, not ideal)
    • Gateway push notification when a new message is added to a session (IM adapter listens and checks if it was from a different client)

Notes

  • Need to track a "last seen" marker per IM binding to know what is new
  • Tool call details should be summarized, not shown in full
  • Respect IM API rate limits when sending multiple catch-up messages

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions