-
Notifications
You must be signed in to change notification settings - Fork 9.8k
feat(core): wire up UI for ASK_USER policy decisions in message bus #10630
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
Changes from all commits
6a5c8bf
65649a0
2a8f8a2
0e9adc5
b85edaf
671ae99
3c8292b
8ae6cac
cbd9261
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,22 @@ class TestToolInvocation extends BaseToolInvocation<TestParams, TestResult> { | |
| testValue: this.params.testParam, | ||
| }; | ||
| } | ||
|
|
||
| override async shouldConfirmExecute( | ||
| abortSignal: AbortSignal, | ||
| ): Promise<false> { | ||
| // This conditional is here to allow testing of the case where there is no message bus. | ||
| if (this.messageBus) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this conditional always evaluate to true? Can we assert on it instead of making it a conditional?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The conditional supports the case where there is no message bus in the test. It's flag guarded so I wanted to test both scenarios. See the test on line 222 for example. |
||
| const decision = await this.getMessageBusDecision(abortSignal); | ||
| if (decision === 'ALLOW') { | ||
| return false; | ||
| } | ||
| if (decision === 'DENY') { | ||
| throw new Error('Tool execution denied by policy'); | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| class TestTool extends BaseDeclarativeTool<TestParams, TestResult> { | ||
|
|
@@ -200,7 +216,7 @@ describe('Message Bus Integration', () => { | |
| abortController.abort(); | ||
|
|
||
| await expect(confirmationPromise).rejects.toThrow( | ||
| 'Tool confirmation aborted', | ||
| 'Tool execution denied by policy', | ||
| ); | ||
| }); | ||
|
|
||
|
|
||
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.
Does this need to be optional?
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 way this is written right now is that this only comes into play when the ASK_USER policy decision is set. Otherwise it's null and falls through to the legacy behviour.