-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(hitl): re-emit swallowed events #13766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to reviewers: This is slightly fragile because we'll only emit hitlStopped
if the underlying integration emits it. Some integrations, however (ie Botpress's own hitl integration) might not emit this event when the stop intent comes from a call to the stopHitl
action. For now, I believe it's good enough, but if we have a specific use-case that is not working properly, we'll want to either:
- modify every single call to
setHitlInactive()
to also emithitlStopped
- store a conversation tag
hitlStoppedEmitted
so that we don't emit it twice
- store a conversation tag
- modify Botpress's hitl integration to emit
hitlStopped
whenstopHitl
is called (this involves a 3-line change in Skynet)
.title('Downstream Conversation ID') | ||
.describe('ID of the downstream conversation'), | ||
humanAgentUserId: sdk.z.string().title('Human Agent User ID').describe('ID of the human agent user'), | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to reviewers: when emitting the events, we also attach the upstream conversation
DO NOT MERGEOn hold until @lakshya0246 can confirm that this is not breaking |
@@ -197,5 +197,31 @@ export default new sdk.PluginDefinition({ | |||
.describe('ID of the downstream conversation'), | |||
}), | |||
}, | |||
hitlAssigned: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: How will we prevent these events from being swallowed by the plugin themselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plugin listens for specifically for hitl:hitlAssigned
, which should prevent it from consuming its own event (hitlAssigned
without the interface prefix). However, now that you mention it, I just noticed that we're doing beforeIncomingEvent('*')
and blanket-swallowing everything 😟. I guess I could modify the handler in hooks.beforeIncomingEvent.all.handleEvent
so that it only swallows events if they have a prefix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@franklevasseur see commit 1318d11. The wildcard event handler now ignores events defined by the plugin itself.
172283f
to
b7ac507
Compare
1318d11
to
43dbb0e
Compare
Resolves CLS-2837