You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace MessageV2.parts(ctx.assistantMessage.id) database call with an in-memory toolCallHistory array tracked in ProcessorContext. The doom loop check already has all the data it needs from the streaming event handler — no need to re-query the database on every tool call.
2. Summary debounce (session/processor.ts)
Run SessionSummary.summarize() only on the first step of a session. Subsequent steps produce summaries that overwrite the first one with no additional value, wasting CPU and I/O on redundant summary computation.
Replace sequential for loop with Effect.forEach({ concurrency: "unbounded" }) so slow plugin event handlers don't block the main event stream. Each handler runs in a forked fiber with error isolation via Effect.tryPromise.
Impact
Optimization
Before
After
Improvement
Doom loop check per tool call
1 DB query
0 (in-memory)
N queries eliminated
Summary computation per step
Every step
First step only
Eliminates redundant work
Plugin event handlers
Sequential
Parallel
2-5x faster with multiple plugins
Risk
Minimal — all three changes are surgical and backward compatible:
Doom loop: same logic, different data source (in-memory vs DB)
Summary: first step behavior unchanged, subsequent steps skip redundant work
Plugin handlers: same input, parallel execution with error isolation
Activity
perf(opencode): optimize doom loop detection, summary debounce, paral…
github-actions commentedon Mar 31, 2026
This issue might be a duplicate of existing issues. Please check:
github-actions commentedon Jul 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.