Versions#
@tanstack/ai 1.5.0 and @tanstack/ai-compaction 1.1.0
- Bun 1.4.4 on macOS arm64. No UI framework.
Describe the bug#
An application can use chat({ debug: false }) or a custom logger for its chat requests, but conversationSummarizer starts a separate chat() call without passing debug. That enables the default error logger for the summary request. Adapter failures can include raw provider response details, so applications need a way to apply the same logging policy to summaries.
Minimal reproduction#
With the versions above installed, run this file with bun run repro.ts. It uses a fake adapter and requires no API key or external requests.
import { chat } from '@tanstack/ai'
import { fakeText } from '@tanstack/ai/testing'
import { conversationSummarizer } from '@tanstack/ai-compaction'
const adapter = fakeText()
const messages = [{ role: 'user', content: 'Summarize this synthetic message' }] as const
adapter.setResponses([
({ request }) => {
console.log('outer chat errors enabled:', request.logger.isEnabled('errors'))
return { text: 'Outer reply' }
},
({ request }) => {
console.log('summary errors enabled:', request.logger.isEnabled('errors'))
return { text: 'Synthetic summary' }
},
])
await chat({ adapter, messages: [...messages], threadId: "repro", stream: false, debug: false })
await conversationSummarizer({ adapter })([...messages], { threadId: 'repro' })
Observed output:
outer chat errors enabled: false
summary errors enabled: true
Expected behavior#
Expose the same debug option on conversationSummarizer and forward it to its internal chat() call. Passing debug: false should disable adapter error logging for the summary too. A custom logger should also work.
The nested call is here in the summarizer. Our current workaround is to set debug: false there.