Skip to content

The open alternative to Salesforce, designed for AI.

Narrow the call recorder summary parser to the fields it reads (#28273)

nitin689272ab9ec4
diff --git a/packages/twenty-apps/public/call-recorder/src/logic-functions/domain/__tests__/parse-call-recording-summary-agent-response.test.ts b/packages/twenty-apps/public/call-recorder/src/logic-functions/domain/__tests__/parse-call-recording-summary-agent-response.test.ts
index 837fd70b7cd..81478d342cc 100644
--- a/packages/twenty-apps/public/call-recorder/src/logic-functions/domain/__tests__/parse-call-recording-summary-agent-response.test.ts
+++ b/packages/twenty-apps/public/call-recorder/src/logic-functions/domain/__tests__/parse-call-recording-summary-agent-response.test.ts
@@ -6,10 +6,7 @@ describe('parseCallRecordingSummaryAgentResponse', () => {
it('returns the trimmed response markdown on success', () => {
expect(
parseCallRecordingSummaryAgentResponse({
- threadId: 'thread-id',
- status: 'COMPLETED',
success: true,
- error: null,
result: { response: ' ## Overview\nGreat call. ' },
}),
).toEqual({ outcome: 'summarized', markdown: '## Overview\nGreat call.' });
@@ -18,10 +15,7 @@ describe('parseCallRecordingSummaryAgentResponse', () => {
it('returns undefined when the run failed', () => {
expect(
parseCallRecordingSummaryAgentResponse({
- threadId: 'thread-id',
- status: 'FAILED',
success: false,
- error: 'no more available credits',
result: null,
}),
).toBeUndefined();
@@ -30,19 +24,13 @@ describe('parseCallRecordingSummaryAgentResponse', () => {
it('returns undefined when the response is empty or missing', () => {
expect(
parseCallRecordingSummaryAgentResponse({
- threadId: 'thread-id',
- status: 'COMPLETED',
success: true,
- error: null,
result: { response: ' ' },
}),
).toBeUndefined();
expect(
parseCallRecordingSummaryAgentResponse({
- threadId: 'thread-id',
- status: 'COMPLETED',
success: true,
- error: null,
result: {},
}),
).toBeUndefined();
@@ -51,10 +39,7 @@ describe('parseCallRecordingSummaryAgentResponse', () => {
it('extracts a grounded reason when the transcript cannot be summarized', () => {
expect(
parseCallRecordingSummaryAgentResponse({
- threadId: 'thread-id',
- status: 'COMPLETED',
success: true,
- error: null,
result: {
response:
'SUMMARY_UNAVAILABLE: The transcript contains only greetings and audio checks.',
@@ -69,10 +54,7 @@ describe('parseCallRecordingSummaryAgentResponse', () => {
it('rejects an unavailable marker without a reason', () => {
expect(
parseCallRecordingSummaryAgentResponse({
- threadId: 'thread-id',
- status: 'COMPLETED',
success: true,
- error: null,
result: { response: 'SUMMARY_UNAVAILABLE:' },
}),
).toBeUndefined();
diff --git a/packages/twenty-apps/public/call-recorder/src/logic-functions/domain/parse-call-recording-summary-agent-response.util.ts b/packages/twenty-apps/public/call-recorder/src/logic-functions/domain/parse-call-recording-summary-agent-response.util.ts
index aa9da12c935..f8d6633d8c8 100644
--- a/packages/twenty-apps/public/call-recorder/src/logic-functions/domain/parse-call-recording-summary-agent-response.util.ts
+++ b/packages/twenty-apps/public/call-recorder/src/logic-functions/domain/parse-call-recording-summary-agent-response.util.ts
@@ -9,7 +9,7 @@ type ParsedCallRecordingSummaryAgentResponse =
| { outcome: 'not-summarizable'; reason: string };
export const parseCallRecordingSummaryAgentResponse = (
- agentResult: RunAgentResult,
+ agentResult: Pick<RunAgentResult, 'success' | 'result'>,
): ParsedCallRecordingSummaryAgentResponse | undefined => {
if (!agentResult.success) {
return undefined;