fix(agents): trim dense text delta snapshots#91580
Conversation
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed June 9, 2026, 12:13 AM ET / 04:13 UTC. Summary PR surface: Source +40, Tests +149. Total +189 across 7 files. Reproducibility: yes. from source and PR proof: dense streams currently carry accumulated snapshots on every plain text delta, and the PR body reports a 30,000-chunk Testbox reproduction. I did not rerun it in this read-only review. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the lightweight-delta path after maintainers accept the exported stream-contract change and the exact PR head passes the targeted and changed checks. Do we have a high-confidence way to reproduce the issue? Yes from source and PR proof: dense streams currently carry accumulated snapshots on every plain text delta, and the PR body reports a 30,000-chunk Testbox reproduction. I did not rerun it in this read-only review. Is this the best way to solve the issue? Yes, pending maintainer acceptance of the contract change: dropping repeated full snapshots at the provider stream boundary and reconstructing in the agent loop is narrower than adding config, throttling, or per-provider fallback branches. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against f05e9873c6d2. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +40, Tests +149. Total +189 across 7 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Land-ready verification for
Maintainer decision recorded in the PR body: accept optional |
|
Adding attribution/context now that this landed and closed #86599: This is directly related to the earlier root-cause analysis in #86599 (comment) and the broader prior implementation attempt in #87558. The merged shape here is smaller and cleaner than #87558: it changes the stream contract so plain So I would treat #87558 and the issue analysis as relevant precursor work, while #91580 is the production-ready implementation shape that actually landed. |
Summary
text_deltaevents for OpenAI-compatible, OpenAI Responses, and Ollama streams.Linked context
Fixes #86599
Related #86633
Requested by maintainer follow-up on #86599.
Maintainer contract decision
Accept the exported stream contract change: plain
AssistantMessageEventtext_deltaevents may omitpartialto avoid retaining one full assistant snapshot per token. Consumers that need the live assistant message should replaydeltafrom the latest start/end partial checkpoint or use the reconstructedmessage_update.message;text_start,text_end, thinking, tool, terminal, and final events still carry full snapshots.Real behavior proof (required for external PRs)
tsdown/runtime-postbuild, then rannode dist/entry.js infer model run --local --model local/dense --prompt hi --jsonagainst the fake backend.infer model run --gatewaywas attempted in isolated Testbox state, but the client was blocked by Gateway device-pairing scope approval. Fullpnpm buildreachedtsdownand runtime-postbuild, then the sparse GWT/Testbox omittedui/config/control-ui-chunking.ts, so the UI build was not counted as passing proof.Tests and validation
node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --timing-json -- env OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 corepack pnpm check:changedontbx_01ktn8y7eph04qd9x71f4ez3we/violet-crab: passed in 9m21s.crabbox run --provider blacksmith-testbox --timing-json --shell -- 'git diff --check && node scripts/run-vitest.mjs run packages/agent-core/src/agent-loop.test.ts src/agents/openai-transport-stream.test.ts extensions/ollama/src/stream-runtime.test.ts'ontbx_01ktn8tztvfyjc9azkj8ayhpf3/silver-shrimp: passed 347 tests in 54.3s.tbx_01ktn5hrk4akdp5558h8f5k8ws/swift-hermit.9569e072e535d677a0dfa2c747a0b12a4ad8c667: ready for maintainer look, proof sufficient, no concrete contributor-facing blocker left.Regression coverage added:
message_update.messagefor immutable, partial-lesstext_deltasnapshots.text_endanddonekeep final content.Risk checklist
Did user-visible behavior change?
YesDid config, environment, or migration behavior change?
NoDid security, auth, secrets, network, or tool execution behavior change?
NoWhat is the highest-risk area?
partial.How is that risk mitigated?
partialas optional and documents the replay contract.