withSandbox: each run's save drops the harness tool calls of earlier runs
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
TanStack AI version
@tanstack/ai-sandbox 1.1.0 and main (644a780b0). @tanstack/ai 1.1.0 and main. @tanstack/ai-persistence 1.0.1.
Framework/Library version
Server only. chat() in a Node 24 route handler. No client framework is involved.
Describe the bug and the steps to reproduce it
With withPersistence and withSandbox on one thread, run 2's save does not contain the harness tool calls of run 1. Only the tool calls of the last run survive. After a reload, every earlier run shows its text but none of its tool cards. docs/sandbox/events.md says that the tool cards come back when the user opens the thread again.
Steps:
- Use a harness adapter (for example
claudeCodeText) withmiddleware: [withPersistence(persistence), withSandbox(sandbox, { instances })]. - Run
chat()on threadt1. The harness runs one tool. The saved thread has the tool call and its result. - Run
chat()again on threadt1. The harness runs one more tool. - Load thread
t1from the message store. Run 1's tool call and result are gone. Run 2's are there.
The middleware order does not change the result.
Suspected cause. withSandbox's onConfig returns { messages: stripObservedToolCalls(config.messages) }. Its comment says that ctx.messages keeps the recorded calls and that only the model request loses them. But applyMiddlewareConfig sets this.messages = config.messages and then middlewareCtx.messages = this.messages. So the stripped list replaces the transcript. The recorder's reconcile restores only the calls of the current run. Then withPersistence's onFinish saves ctx.messages without the earlier runs' calls.
The engine already keeps a separate list for the model request: this.providerMessages = config.providerMessages ?? config.messages.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
The test runs two chat() runs with a fixed harness stream, withPersistence(memoryPersistence()), and withSandbox over a fake provider. It fails on main in both middleware orders:
× a later run keeps the tool calls of earlier runs (persistence first)
× a later run keeps the tool calls of earlier runs (sandbox first)
AssertionError: expected undefined to be defined
expect(pairOf(messages, 'call-run-1').call).toBeDefined()
Tests 2 failed | 14 passed (16)
Do you intend to try to help solve this bug with your own PR?
Yes, I am also opening a PR that solves the problem along side this issue
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
🤖 Created with Claude Opus 5.5 in T3 Code
- Ngôn ngữ chính
- TypeScript
- Star
- 3.3k
- Fork
- 378
- Merge trung bình
- 1 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 254
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TanStack/ai
-
openai-base: a Responses max_output_tokens cutoff ends as RUN_ERROR without usage instead of finishReason 'length'Có thể đã có người làm @tombeckenham đã nhận 8 ngày trước. Đang mởhas-pr waiting-on: maintainer
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
TanStack/ai#1916 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
AG-UI TOOL_CALL_RESULT metadata is dropped in the live stream reducerCó thể đã có người làm @c446984928 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-sandbox: encrypt snapshot blobs at rest with an encrypting blob store wrapperCó thể đã có người làm @AlemTuzlak đã nhận 1 ngày trước. Đang mởwaiting-on: maintainer
TanStack/ai#2062 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Sandbox takeover: the saved transcript loses everything the first host delivered before the restartCó thể đã có người làm @tombeckenham đã nhận 1 ngày trước. Đang mởwaiting-on: maintainer
TanStack/ai#2061 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-compaction: checkpoint never reused when the store returns message keys in another orderCó thể đã có người làm @tombeckenham đã nhận 1 ngày trước. Đang mởhas-pr waiting-on: maintainer
TanStack/ai#2050 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
The sample email preview's ResizeObserver is never disconnected and keeps raising errors after leaving SettingsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:ui bug effort:S priority:P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Typo in WSL project description on Projects pageCó thể đã có người làm @akhil9tiet đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
microsoft/opensource.microsoft.com#1066 · 1 bình luận ·
-
ArcGIS Maps SDK for JavaScript c-carousel calcite-design-tokens enhancement impact - p3 - not time sensitive needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Esri/calcite-design-system#15565 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
linkwarden/linkwarden#1891 ·
Maintainer thường phản hồi trong vòng 1 ngày