GeezerVison is showing github.com — Perf: cut worker-thread saturation/CPU from session diffs, snapshots, SQLite contention, and event fanout (PR #48638 series) · Issue #49974 · anomalyco/opencode
Perf: cut worker-thread saturation/CPU from session diffs, snapshots, SQLite contention, and event fanout (PR #48638 series) #49974DescriptionContext
Part of the fork hardening/perf series proposed in #48638 (integration branch session-diff-events, fork AceRothstein71/opencode). Original tracker: #49565.
PR #48638 is intended to close this issue.
Problem
Under concurrent sessions / parallel agents: worker-thread saturation from permission matching, turn-diff recomputation, event fanout to TUI/server clients, snapshot churn and snapshot-index recovery, and SQLite contention across sessions. Symptoms: stalled turns, high CPU, delayed diffs.
Change set (commit list, session-diff-events)
Validation
- Owner-observed: CPU usage is definitely lower under identical parallel-agent workloads.
- Worker-thread stalls sharply reduced; turn-diff path bounded; mock-verified tool schema (206 tools, zero invalid
required, zero empty combinators).
Linked: PR #48638 · tracker #49565 · sibling tracking issues listed in a follow-up comment. ActivityAceRothstein71 commented on Sep 19, 2026 Cross-links: sibling tracking issues #49974 (perf/runtime), #49975 (shell classifier H-L), #49976 (shell classifier M-P), #49977 (instance lifecycle), #49978 (MCP/schema), #49979 (server/SSE + event/db), #49980 (updater tooling). Integration PR: #48638. Original tracker: #49565. opencodejr commented on Oct 28, 2026 Thanks for putting this together and for working on performance with many parallel agents.
As I understand it, you'd like to reduce worker-thread CPU use and stalls when many sessions or subagents run at once. The changes on your session-diff-events branch target permission matching, turn-diff recomputation, event fanout to TUI/server clients, snapshot churn and recovery, and SQLite contention. Maintainers will consider it. Since this is a broad set of changes, small focused PRs (one subsystem each), each with a workload others can rerun and before/after numbers, will be much easier to review than one integration branch.
Related items:
- Worker-thread saturation under concurrent sessions: permission matching, turn-diff recomputation, event fanout, snapshot churn #49565: the original tracker for the same worker-thread saturation problem (closed by the bot for not using the issue templates)
- fix: harden session diffs, snapshots, and write paths; cut worker-thread stalls under parallel agents #48638: the integration PR this issue refers to (currently closed)
- Durable event table bloats from repeated turn diff payloads #48641: event table bloat from repeated turn-diff payloads, which fix: harden session diffs, snapshots, and write paths; cut worker-thread stalls under parallel agents #48638 originally targeted
- fix(opencode): evict message diff patches from the event payload #42771: an earlier PR that also removed diff patches from event payloads
- Security: fail-closed shell classifier hardening (waves H-L of PR #48638 series) #49975, Security: shell classifier convergence waves M-P under v16-v20 adversarial audits (PR #48638 series) #49976, Lifecycle: reload/teardown safety for instances (bounded drains, interrupt-safe claims, reusable-reload wedge fix) #49977, MCP/schema: validation hardening + anchor-form $ref retention (PR #48638 series) #49978, Server/SSE + event/db hardening (audit-v7 and wave B findings) #49979, Tooling: fork-follow autopatcher (upstream + patch-replay, staging gate, rollback) - contribution proposal #49980: the sibling tracking issues for the other parts of the series
neriousy commented on Nov 19, 2026 This issue tracks the change set from #48638, and that PR was closed without merging, so I'm closing this along with its sibling trackers. If you can reproduce a specific stall or CPU spike under parallel agents on a current release, please open a focused issue with the workload and measurements, or send a small PR for one subsystem.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|