fix(slack): only treat the agent's own bot as the last-agent-reply boundary#704
Open
serhiizghama wants to merge 2 commits into
Open
fix(slack): only treat the agent's own bot as the last-agent-reply boundary#704serhiizghama wants to merge 2 commits into
serhiizghama wants to merge 2 commits into
Conversation
…undary parseThreadMessage marked every bot_id message as isMe, so threadContext "last-agent-reply" cut the boundary at any other app's message and dropped context. Resolve our own bot id via auth.test (once per binding, best-effort) and compare per message. Signed-off-by: serhiizghama <zmrser@gmail.com>
Signed-off-by: serhiizghama <zmrser@gmail.com>
Contributor
|
@serhiizghama is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #694.
threadContext: { since: "last-agent-reply" }was cutting the boundary at any bot's last message, not the agent's own.parseThreadMessagesetisMe: botId !== undefined, so in a thread where a second Slack app also posts (another agent, a workflow bot, an integration), the context got sliced at that other bot instead of the agent's reply — and if the other bot posted right before the mention, the model received zero thread context, silently.The channel never knew its own identity (
SlackChannelCredentialsonly carries a token), soisMehad nothing to compare against. This resolves our ownbot_idviaauth.test— once per binding, in parallel withconversations.replies, best-effort — and marks a message asisMeonly when itsbot_idmatches ours. Ifauth.testfails we fall back to treating nothing as agent-authored, so the boundary widens (full prior thread) rather than truncating.Added a refresh test asserting only the agent's own bot counts as
isMewhile another bot in the same thread does not; reverting the comparison fails it.