Skip to content

A bot mentioned in a thread it has no record of answers as if the thread were empty - nothing backfills the earlier turns #1353

Description

@DEENUU1

What happens

A bot pulled into a thread it has no history of answers as though the thread were
empty, confidently:

kacper  2:10 PM   co tu widzisz?  [screenshot.png]
kacper  2:10 PM   @Jarvis                          (in the thread)
Jarvis  2:10 PM   Looks like your message came through empty —
                  what do you need help with?

The conversation the model is given is built from what this deployment received
and stored. Anything said in the thread before that — because the bot was added
later, because a message was dropped, because the thread predates the binding —
is not in it, and nothing fetches it. So the agent's answer is about a thread it
can only see part of, and it does not know that.

Why the transcript above is not just #1071's file bug

That one is fixed: a file_share message is no longer dropped, so this exact
sequence now works. What is left is the general case, and it is reachable without
any bug — invite a bot to a busy thread and mention it, and it answers the mention
alone.

What could be done

Slack answers conversations.replies for the thread the bot was mentioned in, and
Mattermost has the equivalent. So a turn that opens a conversation inside an
existing thread
could backfill that thread's earlier messages once, the way the
recent-turn window is assembled, bounded by the same message count.

Three things to decide rather than assume:

  • Only on the first turn of a thread we have no record of. Re-fetching per turn
    is a network round trip for something already stored.
  • Whose messages. A thread's earlier turns are other people's, so this widens
    what reaches the model beyond what the sender wrote — which is exactly what
    read_channel_history is gated per binding for. This probably wants the same
    gate rather than being unconditional.
  • read_channel_history reads the channel, not the thread. The tool is bound
    to channel_key(platform_chat_id) (router.py:528), which strips the thread —
    so today an agent cannot ask about the conversation it is actually in. That is
    arguably its own defect and may be the cheaper half of this.

How you would know it was fixed

A bot mentioned partway through a thread answers the question the thread is about,
and a bot mentioned in a thread whose turns it already holds makes no extra API
call.

Related

Cluster Channels and bots in #168. Nearest: #638 (the recent-turn window and
which end it reads from — this is the same window, asked about a source outside
our database), #131 (a channel workspace invisible to the linked account) and
#1351. Not a duplicate; searched thread history, conversations.replies,
channel history.

Found in a real Slack workspace while verifying the fixes on PR #1344.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

effort:mA day or twoenhancementNew feature or requestseverity:mediumCorrectness risk under load or edge input, or a contract that lies

Projects

  • Status
    Done

Relationships

None yet

Development

No branches or pull requests

Issue actions