perf(server): stop retaining unused OpenCode tool history - #9684
Conversation
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This single-file deletion removes unused OpenCode tool-history retention while preserving live part tracking, event emission, thread reads, and rollback behavior. The resulting runtime impact is limited to lower memory usage with no schema, deployment, security, or product-default changes. You can add or adjust custom eligibility rules. Learn more. |
|
how is your experience with gpt6 @t3dotgg ? |
* upstream/main: (30 commits) perf(server): use one query for buffered provider events (pingdotgg#9706) perf(server): stop rebuilding terminal history per chunk (pingdotgg#9703) perf(marketing): serve website fonts locally (pingdotgg#9701) perf(web): defer diff workers until a code view opens (pingdotgg#9692) perf(server): avoid full patches for checkpoint summaries (pingdotgg#9694) perf(marketing): stop continuous homepage motion (pingdotgg#9697) feat(server): measure provider turn token usage (pingdotgg#9132) perf(web): defer composer draft serialization (pingdotgg#9695) perf(mobile): reuse diff rows during comment edits (pingdotgg#9693) perf(clients): avoid waiting to read cached relay tokens (pingdotgg#9691) perf(server): omit repeated OpenCode progress logs (pingdotgg#9689) perf(mobile): reuse chat feed rows during streaming (pingdotgg#9688) perf(server): stop retaining unused OpenCode tool history (pingdotgg#9684) perf(server): batch projector cursor writes (pingdotgg#9671) perf(server): cache and stream static web assets (pingdotgg#9669) perf(marketing): serve images at their display size (pingdotgg#9682) perf(mobile): skip unused legacy list work (pingdotgg#9679) perf(web): keep Markdown mounted during streaming (pingdotgg#9677) perf(mobile): bound diff syntax highlighting work (pingdotgg#9673) fix(web): show machine icons in the environment picker (pingdotgg#9668) ...
## What's Changed * fix(desktop): quit immediately on a second shortcut press by @t3dotgg in pingdotgg/t3code#9657 * fix(server): update Claude Agent SDK to 0.3.260 by @t3dotgg in pingdotgg/t3code#9135 * perf(server): stop loading message bodies for thread summaries by @t3dotgg in pingdotgg/t3code#9662 * perf(web): speed up terminal snapshots by @t3dotgg in pingdotgg/t3code#9663 * fix(web): show machine icons in the environment picker by @t3dotgg in pingdotgg/t3code#9668 * perf(mobile): bound diff syntax highlighting work by @t3dotgg in pingdotgg/t3code#9673 * perf(web): keep Markdown mounted during streaming by @t3dotgg in pingdotgg/t3code#9677 * perf(mobile): skip unused legacy list work by @t3dotgg in pingdotgg/t3code#9679 * perf(marketing): serve images at their display size by @t3dotgg in pingdotgg/t3code#9682 * perf(server): cache and stream static web assets by @t3dotgg in pingdotgg/t3code#9669 * perf(server): batch projector cursor writes by @t3dotgg in pingdotgg/t3code#9671 * perf(server): stop retaining unused OpenCode tool history by @t3dotgg in pingdotgg/t3code#9684 * perf(mobile): reuse chat feed rows during streaming by @t3dotgg in pingdotgg/t3code#9688 * perf(server): omit repeated OpenCode progress logs by @t3dotgg in pingdotgg/t3code#9689 * perf(clients): avoid waiting to read cached relay tokens by @t3dotgg in pingdotgg/t3code#9691 * perf(mobile): reuse diff rows during comment edits by @t3dotgg in pingdotgg/t3code#9693 * perf(web): defer composer draft serialization by @t3dotgg in pingdotgg/t3code#9695 * feat(server): measure provider turn token usage by @t3dotgg in pingdotgg/t3code#9132 * perf(marketing): stop continuous homepage motion by @t3dotgg in pingdotgg/t3code#9697 * perf(server): avoid full patches for checkpoint summaries by @t3dotgg in pingdotgg/t3code#9694 * perf(web): defer diff workers until a code view opens by @t3dotgg in pingdotgg/t3code#9692 * perf(marketing): serve website fonts locally by @t3dotgg in pingdotgg/t3code#9701 * perf(server): stop rebuilding terminal history per chunk by @t3dotgg in pingdotgg/t3code#9703 **Full Changelog**: pingdotgg/t3code@v0.0.39-nightly.20260904.1278...v0.0.39-nightly.20260904.1279 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.39-nightly.20260904.1279
OpenCode keeps every version of tool output in a session history array that nothing reads. The audit fixture retained 5,171,200 logical output bytes for a tool whose final output was 102,400 bytes.
Remove that array and its append helpers. Thread reads and rollback still fetch upstream messages. Keep the live part map and event delivery unchanged.
Verified with 116 existing adapter and provider tests, server typecheck, and targeted lint. No browser, device, or live state was used.
Part of #9661. Other session-map retention remains separate work.
Created with GPT-6 Astra (preview) in Codex.
Note
Low Risk
Deletion-only memory optimization with no callers of the removed snapshot path; thread read/rollback still use upstream APIs.
Overview
Removes the in-memory
turnsarray on OpenCode session context and theresolveTurnSnapshot/appendTurnItemhelpers that pushed every toolPartupdate into it duringmessage.part.updatedhandling.That history was never read in the adapter—only grown—so long tool streams could retain huge redundant output while live behavior stays on
partById, text delta maps, and runtime event emission.readThreadandrollbackThreadare unchanged: they still load conversation shape fromsession.messages/session.revert, not from session context.Reviewed by Cursor Bugbot for commit ecc5669. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Remove unused OpenCode turn-snapshot retention from
OpenCodeAdapterOpenCodeSessionContextand theresolveTurnSnapshotandappendTurnItemhelpers, as this history was retained but never read.makeOpenCodeAdaptersession-context initialization no longer allocates snapshot storage, and the event-part handler stops recording processed parts to per-turn snapshots before emitting the runtime event.Macroscope summarized ecc5669.