feat(ai-compaction): preserve history with persisted checkpoints - #1250
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit 08c0ad6
☁️ Nx Cloud last updated this comment at |
@tanstack/ai
@tanstack/ai-acp
@tanstack/ai-angular
@tanstack/ai-anthropic
@tanstack/ai-bedrock
@tanstack/ai-byteplus
@tanstack/ai-claude-code
@tanstack/ai-client
@tanstack/ai-code-mode
@tanstack/ai-code-mode-snippets
@tanstack/ai-codex
@tanstack/ai-cohere
@tanstack/ai-compaction
@tanstack/ai-devtools-core
@tanstack/ai-durable-stream
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-grok-build
@tanstack/ai-groq
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-daytona
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-isolate-quickjs-bun
@tanstack/ai-llmgateway
@tanstack/ai-lovable
@tanstack/ai-mcp
@tanstack/ai-memory
@tanstack/ai-mistral
@tanstack/ai-octane
@tanstack/ai-ollama
@tanstack/ai-openai
@tanstack/ai-opencode
@tanstack/ai-openrouter
@tanstack/ai-perplexity
@tanstack/ai-persistence
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-react-ui
@tanstack/ai-sandbox
@tanstack/ai-sandbox-cloudflare
@tanstack/ai-sandbox-daytona
@tanstack/ai-sandbox-docker
@tanstack/ai-sandbox-local-process
@tanstack/ai-sandbox-sprites
@tanstack/ai-sandbox-vercel
@tanstack/ai-solid
@tanstack/ai-solid-ui
@tanstack/ai-svelte
@tanstack/ai-utils
@tanstack/ai-vercel-gateway
@tanstack/ai-vertex
@tanstack/ai-vue
@tanstack/ai-vue-ui
@tanstack/openai-base
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
@tanstack/svelte-ai-devtools
commit: |
Compaction now changes only provider context. The persisted transcript stays complete, and metadata-backed checkpoints prevent repeated compaction of the same prefix.
What changed
providerMessagesas the temporary provider context.MetadataCapabilityin@tanstack/ai.Testing
Commands run
@tanstack/ai,@tanstack/ai-compaction, and@tanstack/ai-persistence.publintfor the three changed packages.pnpm test:docs,pnpm test:sherif, andpnpm test:knip.pnpm buildreported successful builds for all 61 affected packages, then exited withEISDIR: illegal operation on a directory, lstat 'F:'on Windows.@tanstack/ai-openai.Manual test
pnpm --filter @tanstack/ai exec vitest run tests/provider-messages.test.ts.pnpm --filter @tanstack/ai-compaction exec vitest run src/index.test.ts.pnpm --filter @tanstack/ai-e2e test:e2e -- tests/compaction-wire.spec.ts.Easy test path
The core test covers canonical and provider context through a tool loop. The compaction test covers checkpoint reuse, stale prefixes, and cancellation. The E2E route covers persistence and reload behavior.
Risk / rollback
The main risk is middleware composition. Middleware that returns
messageskeeps the old behavior, whileproviderMessagesaffects provider input only. Revert this PR to restore the base branch behavior.Public API change
Before
After
Custom compaction strategies can set a stable checkpoint identity: