这是indexloc提供的服务,不要输入任何密码
Skip to content

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

pascal-botpress
Copy link
Member

@pascal-botpress pascal-botpress commented Apr 7, 2025

Resolves CLS-2837

@pascal-botpress pascal-botpress requested a review from a team as a code owner April 7, 2025 20:06
Copy link
Member Author

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 emit hitlStopped
    • store a conversation tag hitlStoppedEmitted so that we don't emit it twice
  • modify Botpress's hitl integration to emit hitlStopped when stopHitl 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'),
}),
Copy link
Member Author

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

@pascal-botpress pascal-botpress added the on hold On Hold (Not Ready) label Apr 7, 2025
@pascal-botpress
Copy link
Member Author

DO NOT MERGE

On 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: {
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on hold On Hold (Not Ready)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants