fix: preserve complete session loading error details

This commit is contained in:
digua committed 2026-09-23 11:36:38 +08:00
1 parent 83c28c026f
commit 80fcaa7ea2
3 files changed
+11 -5

No files matched your search

@@ -243,8 +243,9 @@ describe('runAgentCore runtime contract', () => {
})
)
assert.equal(result.error, undefined)
assert.equal(captured?.messages[0].content[0].type, 'text')
assert.equal(captured?.messages[0].content[0].text, historyText)
const firstBlock = captured?.messages[0].content[0]
assert.ok(typeof firstBlock === 'object' && firstBlock.type === 'text')
assert.equal(firstBlock.text, historyText)
assert.equal(outputBudget, 2048, 'Preserve the configured output budget when the history and answer both fit')
})
@@ -10,7 +10,7 @@
import * as fs from 'fs'
import * as path from 'path'
import { extractErrorInfo, extractErrorStack } from '../ai/ai-logger'
import { extractErrorInfo } from '../ai/ai-logger'
type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'
@@ -92,7 +92,7 @@ function formatData(data: unknown): string {
if (data === undefined) return ''
if (data instanceof Error) {
const info = extractErrorInfo(data)
const stack = extractErrorStack(data)
const stack = data.stack
return JSON.stringify(info) + (stack ? `\n${stack}` : '')
}
if (typeof data === 'string') return data