@@ -306,7 +306,6 @@ const createNotifyOnExitExecTool = (overrides: Partial<ExecToolConfig> = {}) =>
|
306 | 306 | allowBackground: true, |
307 | 307 | backgroundMs: 0, |
308 | 308 | notifyOnExit: true, |
309 | | -notifyOnExitEmptySuccess: true, |
310 | 309 | sessionKey: DEFAULT_NOTIFY_SESSION_KEY, |
311 | 310 | ...overrides, |
312 | 311 | }); |
@@ -527,12 +526,26 @@ type DisallowedElevationCase = LabeledCase & {
|
527 | 526 | expectedOutputIncludes?: string; |
528 | 527 | }; |
529 | 528 | type NotifyNoopCase = LabeledCase & { |
530 | | -notifyOnExitEmptySuccess: boolean; |
| 529 | +defaults?: Partial<ExecToolConfig>; |
| 530 | +expectNotification: boolean; |
531 | 531 | }; |
532 | 532 | const NOOP_NOTIFY_CASES: NotifyNoopCase[] = [ |
533 | | -withLabel("default behavior skips no-op completion events", { notifyOnExitEmptySuccess: false }), |
| 533 | +withLabel("default behavior skips no-op completion events", { expectNotification: false }), |
| 534 | +withLabel("chat providers default no-op completion notifications on", { |
| 535 | +defaults: { messageProvider: " Telegram " }, |
| 536 | +expectNotification: true, |
| 537 | +}), |
| 538 | +withLabel("explicit false keeps chat provider no-op completions silent", { |
| 539 | +defaults: { messageProvider: "telegram", notifyOnExitEmptySuccess: false }, |
| 540 | +expectNotification: false, |
| 541 | +}), |
| 542 | +withLabel("generic providers keep no-op completions silent by default", { |
| 543 | +defaults: { messageProvider: "generic" }, |
| 544 | +expectNotification: false, |
| 545 | +}), |
534 | 546 | withLabel("explicitly enabling no-op completion emits completion events", { |
535 | | -notifyOnExitEmptySuccess: true, |
| 547 | +defaults: { notifyOnExitEmptySuccess: true }, |
| 548 | +expectNotification: true, |
536 | 549 | }), |
537 | 550 | ]; |
538 | 551 | const DISALLOWED_ELEVATION_CASES: DisallowedElevationCase[] = [ |
@@ -582,11 +595,11 @@ const LONG_LOG_EXPECTATION_CASES: LongLogExpectationCase[] = [
|
582 | 595 | ]; |
583 | 596 | const expectNotifyNoopEvents = ( |
584 | 597 | events: string[], |
585 | | -notifyOnExitEmptySuccess: boolean, |
| 598 | +expectNotification: boolean, |
586 | 599 | sessionId: string, |
587 | 600 | label: string, |
588 | 601 | ) => { |
589 | | -if (!notifyOnExitEmptySuccess) { |
| 602 | +if (!expectNotification) { |
590 | 603 | expect(events, label).toStrictEqual([]); |
591 | 604 | return; |
592 | 605 | } |
@@ -682,13 +695,13 @@ const runLongLogExpectationCase = async ({
|
682 | 695 | expectTextContainsValues(snapshot.text, mustContain, true); |
683 | 696 | expectTextContainsValues(snapshot.text, mustNotContain, false); |
684 | 697 | }; |
685 | | -const runNotifyNoopCase = async ({ label, notifyOnExitEmptySuccess }: NotifyNoopCase) => { |
686 | | -const tool = createNotifyOnExitExecTool({ notifyOnExitEmptySuccess }); |
| 698 | +const runNotifyNoopCase = async ({ label, defaults, expectNotification }: NotifyNoopCase) => { |
| 699 | +const tool = createNotifyOnExitExecTool(defaults); |
687 | 700 | |
688 | 701 | const { sessionId, status } = await runBackgroundCommandToCompletion(tool, COMMAND_NOOP); |
689 | 702 | expect(status).toBe(PROCESS_STATUS_COMPLETED); |
690 | 703 | const events = peekSystemEvents(DEFAULT_NOTIFY_SESSION_KEY); |
691 | | -expectNotifyNoopEvents(events, notifyOnExitEmptySuccess, sessionId, label); |
| 704 | +expectNotifyNoopEvents(events, expectNotification, sessionId, label); |
692 | 705 | }; |
693 | 706 | |
694 | 707 | describe("tool descriptions", () => { |
|