From 924767423d3e436d65d2ababbb912a3c1dab5b71 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Thu, 5 Nov 2026 09:17:39 +0000 Subject: [PATCH 1/4] fix(agent): say when stored reasoning was shortened (BE-24672) The server caps stored thinking per round and per turn and now marks the entry where the stored reasoning stops being whole with truncated: true. Carry that mark through the transcript and the activity rows, and show a short notice under that thinking row. --- src/locales/en/main.json | 1 + .../agent/message/ActivityTrace.test.ts | 35 +++++++++++++++++++ .../agent/message/ActivityTrace.vue | 23 +++++++----- .../agent/schemas/agentApiSchema.ts | 9 +++-- .../services/agent/agentActivityRows.test.ts | 12 +++++++ .../agent/services/agent/agentActivityRows.ts | 7 ++-- .../agent/services/agent/agentMessageParts.ts | 2 ++ .../services/agent/agentTranscript.test.ts | 21 +++++++++++ .../agent/services/agent/agentTranscript.ts | 8 ++++- 9 files changed, 105 insertions(+), 13 deletions(-) create mode 100644 src/workbench/extensions/agent/components/agent/message/ActivityTrace.test.ts diff --git a/src/locales/en/main.json b/src/locales/en/main.json index e52aac4dfab..3a984cb66b9 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -6250,6 +6250,7 @@ "viewAddedNodes": "View node | View nodes", "stopShortcut": "Esc", "thinking": "Thinking...", + "thinkingShortened": "Reasoning shortened: the rest was too long to save.", "working": "Working...", "helpful": "Helpful", "notHelpful": "Not helpful", diff --git a/src/workbench/extensions/agent/components/agent/message/ActivityTrace.test.ts b/src/workbench/extensions/agent/components/agent/message/ActivityTrace.test.ts new file mode 100644 index 00000000000..02be5d9427b --- /dev/null +++ b/src/workbench/extensions/agent/components/agent/message/ActivityTrace.test.ts @@ -0,0 +1,35 @@ +import { render, screen } from '@testing-library/vue' +import { describe, expect, it } from 'vitest' + +import { i18n } from '@/i18n' +import type { ActivityPart } from '@/workbench/extensions/agent/services/agent/agentMessageParts' + +import ActivityTrace from './ActivityTrace.vue' + +function renderTrace(parts: ActivityPart[]) { + return render(ActivityTrace, { + props: { parts }, + global: { plugins: [i18n] } + }) +} + +describe('ActivityTrace', () => { + it('BE-24672: says the reasoning was shortened where the stored thinking stops being whole', () => { + renderTrace([ + { type: 'thinking', text: 'Round one.', state: 'done' }, + { type: 'thinking', text: 'Round two…', state: 'done', truncated: true } + ]) + + const notices = screen.getAllByTestId('agent-thinking-shortened') + expect(notices).toHaveLength(1) + expect(notices[0].textContent).toBe( + 'Reasoning shortened: the rest was too long to save.' + ) + }) + + it('shows no notice for a whole trace', () => { + renderTrace([{ type: 'thinking', text: 'Round one.', state: 'done' }]) + + expect(screen.queryByTestId('agent-thinking-shortened')).toBeNull() + }) +}) diff --git a/src/workbench/extensions/agent/components/agent/message/ActivityTrace.vue b/src/workbench/extensions/agent/components/agent/message/ActivityTrace.vue index 71b8dec01eb..db12f2d6763 100644 --- a/src/workbench/extensions/agent/components/agent/message/ActivityTrace.vue +++ b/src/workbench/extensions/agent/components/agent/message/ActivityTrace.vue @@ -81,7 +81,7 @@ function rowSignature(row: ActivityRow): string { row.canvasConfirmed, row.count ]) - : `think:${row.state}:${row.text}` + : `think:${row.state}:${row.truncated === true}:${row.text}` } @@ -105,13 +105,20 @@ function rowSignature(row: ActivityRow): string { />
- {{ row.text || t('agent.thinking') }} +
+ {{ row.text || t('agent.thinking') }} + {{ t('agent.thinkingShortened') }} +