perf(server): index OpenCode text by message and drop unused tool parts - #251
Conversation
The adapter kept every OpenCode part, including tool input and output, and scanned that map on each assistant metadata event. Keep only per-message text state for later PATCH edits, emit tool lifecycle without retaining payloads, and drop the unused live turn-item history. Native log filtering stays with the projection-perf logger work. OpenCode Go stays on Mastra. Adapted from pingdotgg#9684, pingdotgg#9738, and pingdotgg#10116. Made with Grok 4.6 High in Grok Build via Orca.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis update clears retained OpenCode text state when an individual message part is removed, so later assistant metadata updates cannot re-emit content that OpenCode has deleted. Regression coverage and provider documentation were updated alongside the adapter behavior. Confidence Score: 5/5Safe to merge; there are no outstanding blocking findings. The previously reported stale-content issue is resolved in the current code: Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
# Conflicts: # apps/server/src/provider/Layers/OpenCodeAdapter.test.ts # apps/server/src/provider/Layers/OpenCodeAdapter.ts # docs/internals/providers.md
Problem
The legacy OpenCode adapter retained every part in a
Map<string, Part>, including growing tool output, and scanned that map on each assistant metadata event. It also accumulated unused live turn items. Long sessions kept payloads that no reader needed. Individually removed text parts could also be emitted again after late assistant metadata arrived.Adaptation
This does not change native event log filtering. That belongs to the projection performance work already merged through #240. OpenCode Go stays on Mastra.
Upstream
Adapted from pingdotgg/t3code#9684, #9738, and #10116.
Verification
vp test run apps/server/src/provider/Layers/OpenCodeAdapter.test.ts— 44 tests passed, including individual part removal and late assistant metadata after 24 completed tool parts.Made with GPT-5.6 Sol in T3 Code through the Codex harness.