GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: harden session diffs, snapshots, and write paths; cut worker-thread stalls under parallel agents by AceRothstein71 · Pull Request #48638 · anomalyco/opencode

Conversation

@AceRothstein71

@AceRothstein71 AceRothstein71 commented Sep 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Closes #48641

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

SessionSummary.summarize attaches the turn's full git patch text to the user message's summary.diffs, and it is forked on every step-finish for the same message. Each run republishes the whole message, patches included, as a new immutable message.updated.1 row. Sampling 400 such rows locally: the 25% carrying summary average 400.8 KB, the other 75% average 0.55 KB — roughly 49 GB of a 79 GB database, nearly all of it the same patch text rewritten.

The fix has three parts:

  1. Dedup at the amplifier. summarize now compares the freshly computed diff array against the hydrated current one with isDeepStrictEqual. Unchanged publishes nothing; changed publishes a full replacement. This is the part that actually matters — a guard in updateMessage does nothing, because summarize never calls it.
  2. A dedicated event. Patch text moves to message.diff.updated.1 with a message_diff table keyed by (sessionID, messageID), cascading on both session and message delete. List and single-message reads hydrate from it; MessageTable.data.summary.diffs stays as the fallback for historic rows, so existing events project exactly as before and no backfill is needed. The migration is O(1) and guarded with IF NOT EXISTS.
  3. Client consumption. The payload also goes out on the live bus, and app/src/utils/diffs.ts filters entries whose patch is not a string, so without the app/TUI changes summary.diffs would render empty. Those clients now consume the diff event and buffer it across in-flight message loads.

Measured on a 300,000-character snapshot with four identical summarize calls, counting real bytes written to the event table:

bytes
dev 4 × 300,511 = 1,202,044
this branch 1 × 300,341
avoided 901,703 (75.0%)

A changed diff set still writes one full event, so the pessimal workload is neutral rather than worse.

One deliberate behavior change: a diff event for a turn that is not cached and has no in-flight load no longer triggers a fetch to go find it. The diff appears on the next fetch that includes that turn. No persisted data is lost. I took this route because the alternative required reworking the session client's sync-lifetime model, which is a pre-existing concern on dev and much larger than this fix — happy to follow up on that separately.

How did you verify your code works?

bun typecheck clean in schema, core, opencode, app and tui.

Test counts on the branch: schema 15/0, core 1098/0, tui 203/0, app 672 pass with 9 failures that are pre-existing (a clean dev worktree gives 645 pass / 10 fail on the same suite). packages/opencode was 3596/0 on this content; my sandbox later ran out of disk and that suite went non-deterministic on dev too, so I am flagging that rather than claiming a clean run.

For the measurement I wrote a fixture that drives real summarize calls with snapshot tracking and counts durable EventTable rows, so the 75.0% comes from bytes actually written rather than from a mock.

Every new test was written mutation-first: break the behavior, confirm the suite still passes, add the test, confirm it fails, revert, confirm it passes. That protocol caught several tests that could not fail.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Update: performance hardening (follow-up commits on this branch)

Live profiling of multi-agent workloads surfaced more issues in the same pipeline. Additional commits now on this branch:

Session diff pipeline

  • summarize runs its early-return checks before writing/resetting diffs; the projector skips redundant message_diff upserts; diffFull/revert yield between batches
  • turnMessages pages newest-first and stops at the target turn (no full-history scans)
  • step-finish skips snapshot.patch() when the completed tree equals the tracked tree
  • diff() reads the stored turn diff directly instead of walking message pages
  • assistant children that sort outside the target page window are backfilled (prevents silently empty turn diffs on boundary rows)
  • superseded diff payloads are tombstoned instead of deleted (per-aggregate seqs stay contiguous for replay); per-file patch text capped at 1 MB with a truncated flag
  • regression tests: backfill boundary, patch cap, old-turn diff reads

Write path / responsiveness

  • the TUI worker batches global events on a 16 ms tick and coalesces adjacent message.part.delta events (one cross-thread message per flush instead of one per token)
  • sqlite read/write lanes: plain SELECT/EXPLAIN runs on a second read-only connection (PRAGMA query_only), writes stay gated, statements inside a transaction route through the transaction connection; WAL growth bounded (wal_autocheckpoint = 4000, journal_size_limit = 32MB, 5-minute wal_checkpoint(PASSIVE) loop); shell tool throttles per-chunk durable metadata writes to 200 ms with a guaranteed trailing flush; file-backed split-driver tests added

Validation for these additions: packages/core typecheck clean + full suite 1101 pass / 0 fail; packages/opencode typecheck clean + 9-file battery 222 pass / 1 skip / 0 fail; prettier clean; the write-path change set was independently reviewed by two models, both SHIP.

Documented limitations (intentionally unchanged): summarize early-returns also skip the diff reset on snapshot: false / empty-turn / non-user paths; the step-finish patch skip can miss worktree writes landing between track() and the patch re-stage (mirror-image race pre-existed); oversized files surface an empty patch with truncated: true for consumers that opt in.

Update: performance hardening (follow-up commits on this branch)

Since the original description, this branch picked up a set of performance and robustness follow-ups:

Session diff pipeline

  • summarize runs its early-return checks before writing or resetting diffs, and the projector skips redundant message_diff upserts.
  • turnMessages pages newest-first and stops at the target turn instead of scanning the full history; diff() reads the stored turn diff directly.
  • Step-finish skips snapshot.patch() when the completed tree is unchanged.
  • Assistant children that sort outside the target page window are backfilled (prevents silently empty turn diffs).
  • Superseded message.diff.updated payloads are tombstoned instead of deleted (per-aggregate seqs stay contiguous for replay); per-file patch text is capped at 1 MB with a truncated flag.

Write path / responsiveness

  • The TUI worker buffers global events on a 16 ms tick and coalesces adjacent message.part.delta events.
  • sqlite read/write lanes: plain reads use a second read-only connection so they never queue behind the write semaphore; writes stay gated; in-transaction statements route through the transaction connection. WAL is bounded via wal_autocheckpoint = 4000, journal_size_limit = 32MB, and a 5-minute wal_checkpoint(PASSIVE) loop.
  • The shell tool throttles per-chunk durable metadata writes to 200 ms with a guaranteed trailing flush.

Validation

  • packages/core typecheck clean, 1101 pass / 0 fail; packages/opencode typecheck clean, battery 222 pass / 1 skip / 0 fail; prettier clean.
  • New file-backed sqlite-split tests cover cross-connection read-after-write, in-transaction visibility, and rollback isolation.
  • The write-path change set was independently reviewed by two models; both returned SHIP with no remaining blockers.

Documented limitations

  • summarize early-returns skip the diff reset on snapshot: false, empty-turn, and non-user paths; historic diffs persist until the next summarize.
  • The step-finish patch skip can miss worktree writes landing between track() and the patch re-stage; the mirror-image race pre-existed.
  • Oversized files surface an empty patch with truncated: true; consumers rendering that flag can follow up.

Closes #48848 (snapshot transaction serialization, included in this branch).

Also closes #48848.


Closes #48641, closes #48848.

More issues this closes

Closes #46833, closes #48616.

Also addresses (partial or related)

  • EventV2 cold history duplicates large snapshot payloads and amplifies SQLite storage/reads #47854 — diff dedup, tombstoned superseded payloads, and 1 MB payload caps cut the duplication and storage amplification this follow-up measures; the proposed cold-history storage redesign is out of scope here.
  • "Snapshot mechanism stalls on large workspaces: ~1min per git snapshot, permanent index.lock deadlock after a crash" #42597 — snapshot transaction serialization plus abandoned-token reclaim remove the stale index.lock deadlock after a crash; per-snapshot git add -A cost on very large workspaces remains git-bound.
  • tui: background subagent load freezes tab switching and text input #43891 — worker-to-TUI event batching removes the per-event cross-thread flood behind multi-subagent TUI sluggishness.
  • TUI lag with multi-subagent sessions (97% CPU on render thread) #42657 — the same batching coalesces subagent stream churn (16 ms flush, adjacent delta merges) to reduce render-thread saturation.
  • TUI becomes laggy/unresponsive with large sessions (1000+ messages) #38435 — bounded newest-first paging, direct diff reads, and event batching lower large-session UI load.
  • [BUG] SQLite WAL grows unbounded (10–15 GB) while Desktop is running — disk fills to 0, recovers only on full quit #37495 — raised autocheckpoint window, journal size limit, and a periodic PASSIVE checkpoint loop bound normal WAL growth; the long-lived-reader starvation case in that report still needs connection hygiene.
  • snapshot: corrupt index causes repeated capture failures and unresponsive service #42237 — hardened snapshot failure paths and reclaimed abandoned transaction tokens stop repeated capture failures from wedging the service.

Follow-up hardening (extension commits on this branch)

  • fix(tui): the TUI worker drops the bridge's duplicate "sync" mirrors before forwarding events over the RPC. Those copies exist for workspace sync consumers and the TUI ignores them on receipt, so they no longer cross the thread boundary, cutting event-forwarding volume further under heavy lane load.
  • fix(snapshot): the snapshot machinery now recovers from a corrupt index in its derived snapshot gitdir. It detects git's index-corruption error, deletes the derived index, retries the command once, and logs snapshot_index_corruption_recovered. Previously a corrupt index silently wedged every subsequent snapshot. A new worker-level regression test proves the one-shot recovery.

Closes #42237.

  • fix(snapshot) hardening follow-up (6c1ddb3): closes a silent-corruption gap found in review - a truncated index could make track record the git empty tree as a successful snapshot (revert then treats every file as absent). track now detects the empty-tree result, rebuilds the derived index and recaptures once (a genuinely empty worktree is still accepted), corruption detection covers the index-listing commands and more git error shapes, and recovery retries safely when two lookups race. Added corrupt- and truncated-index recovery tests that assert the recovered tree contains the changed file.

Audit hardening (6c1ddb3)

  • fix(snapshot): heal silent empty-tree snapshots and widen index corruption recovery — a truncated index could previously record the git empty tree as a successful snapshot, and a later revert would treat tracked files as absent; track() now detects the empty tree, rebuilds the derived snapshot index and recaptures once (a genuinely empty worktree is still accepted), corruption detection also covers the index-listing commands and more git error shapes, and the recovery retry is safe under concurrent double-recovery. New regression tests cover corrupt and truncated index recovery and assert the recovered tree contains the changed file.

Tracked performance issue

Addresses #49565 — the permission-path, turn-diff, event-fanout, and snapshot-churn fixes described there land on this branch as they are reviewed.

Concurrent-session event-loop batch (d84bbc6)

Cuts per-event and per-step work on the session worker thread so many concurrent lanes stop queueing behind it:

  • permission checks reuse a compiled wildcard regex cache; the per-pattern permission log is demoted; rulesets are flattened once and approved rules deduped
  • from === to turn spans short-circuit before diffFull; the last turn diff is memoized per session/message (non-empty results only, bounded) with single-flight summarize; the summarize fork is skipped when a step's snapshot tree is unchanged
  • patch(hash, { to }) diffs the two trees directly instead of re-staging the shared snapshot index
  • SSE clients get events filtered before enqueue, a bounded dropping queue, and a server.desync marker when they fall behind
  • the per-directory Location.Info payload is memoized and frozen; part deltas merge by part key instead of adjacency; raw deltas no longer dispatch to plugin hooks; the periodic WAL checkpoint interval is jittered

Validation: core typecheck + full suite 1106 pass / 0 fail; opencode typecheck + snapshot/session/event batteries 122 tests / 0 fail (one wall-clock-sensitive snapshot-lock test flaked at 10.4s under live load; reruns pass at 6.3s); prettier clean. Treats the worker-thread saturation described in #49565.

Workspace diff context bound

PATCH_CONTEXT_LINES defaulted to 2_147_483_647, which overflows git's hunk-merge arithmetic: every hunk re-emitted the whole file, producing >1 GB of patch text and ~11 s of CPU per filesystem event (#49267). The diff path now clamps the effective context to MAX_PATCH_CONTEXT_LINES (1,000,000) so hunks merge into one full-context hunk per file; a regression test edits a file 400 lines apart and asserts it is emitted exactly once.

Closes #49267.

Ripgrep entry callback linearized

The filesystem search layer rebuilt its directory index on every ripgrep entry (Array.from per file) and re-joined path prefixes, making initial scans of large trees O(files × directories) (#37869). Directories now accumulate in place in a set and materialize once per query; the search-layer suite covers it.

Closes #37869.

Ripgrep entry callback linearized

The filesystem search index rebuilt state.directories with Array.from(...) on every ripgrep entry (O(files × directories) for large trees) and re-joined every path prefix per entry. Directories now accumulate in a Set in place with incremental prefixes and are materialized once per query.

Closes #37869.

Instance cache bound

The per-directory instance cache was unbounded: a long-lived serve process that visits many directories kept every instance (and its bootstrap resources, including MCP child processes) alive until an explicit dispose. The cache now holds at most 16 instances, refreshing recency on access and evicting the oldest completed entry (in-flight boots are never evicted). A regression test loads 17 directories and asserts the first is disposed.

Reverted in 4551204c pending an in-use guard (refcount + awaiter protection); see #47727 for requirements.

Audit convergence (fdb3778)

Full-branch audits (two independent reviewers) produced ranked P0-P3 findings; this commit addresses the blocking ones:

  • diffFull now returns undefined on failure or when snapshots are disabled, and summarize never publishes an empty diff over a stored one (prevents silent, unrecoverable diff loss under lock contention)
  • SSE uses a single bounded drop-oldest queue; the unconsumed server.desync marker was removed (no wire-protocol change)
  • reads are gated on the shared connection when read/write lanes alias (:memory:, disableWAL), preventing dirty reads
  • diff memo bounded to 8 entries with copies on both paths; snapshot corruption recovery logged only after a successful retry; reader page cache halved; pending delta merges invalidated on message/session lifecycle events; SDK regenerated for FileDiff.truncated
  • the instance cache bound was reverted pending a refcount/in-use design (see serve: per-request instances are never disposed - MCP child processes accumulate until memory exhaustion #47727)

Reviewed but not fixed in this branch: #46341 (partially addressed by the write-amplification fixes here), #49552, #42306, #46437 (upstream Bun/Effect fix pending), #34574 (bundled AI SDK runtime).

Audit convergence (fdb3778)

Post-audit hardening based on two independent full-branch reviews:

  • diffFull now returns undefined on lock failure or disabled snapshots, and summarize never publishes an empty diff over a stored one (closes the silent data-loss path)
  • the SSE handler keeps a single bounded drop-oldest queue and the unconsumed server.desync marker was removed
  • SQLite reads are gated on the shared connection when the read/write lanes alias (:memory:, disableWAL) so they cannot observe uncommitted rows
  • the per-message diff memo is bounded to 8 entries and returns copies on both paths; the reader connection page cache is halved
  • snapshot corruption recovery logs "recovered" only after a successful retry; delta merging invalidates on message/session lifecycle events; the SDK was regenerated for FileDiff.truncated
  • the instance cache bound was reverted pending an in-use guard (see serve: per-request instances are never disposed - MCP child processes accumulate until memory exhaustion #47727)

Reviewed but not fixed here (tracked upstream): #46341 (large-history CPU/memory — this branch removes most of the write amplification; retention policy is a follow-up), #49552 (web render cost — the client already batches per frame; deeper render work pending), #42306 (TUI spinner cost lives in the render dependency; animations can be disabled), #46437 (Bun serve dispatch regression; upstream fix in bun), #34574 (listener leak inside the bundled AI SDK runtime; our own listener usage was audited clean).

Streaming delta coalescing (41b33fe)

Live profiling showed the session worker thread pinned at ~99% while the database saw zero events — the remaining cost was the non-durable per-token delta path. Streaming message.part.delta events are now accumulated per part field in the processor and flushed on a 40 ms cadence (or immediately before the part's final text/reasoning update), so one publish covers a whole window instead of one per token. Final part content is unaffected because the completed part is still published by the existing text-end and reasoning-end updates.

Streaming delta coalescing (41b33fe)

Live profiling on a busy instance showed the session worker pinned at ~99% CPU while the durable event tables saw zero writes — the remaining load was the non-durable per-token delta path. Streaming deltas are now accumulated per part field in the processor and flushed on a 40 ms cadence, or immediately before the part's final full update (text-end / reasoning-end), so ordering is preserved and final part content is unchanged while the pipeline sees one publish per window instead of one per token.


Linked issues

Closes #49974

Tracking (stacked-PR plan): #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).

Original tracker: #49565.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
sisyphus-dev-ai added 30 commits September 11, 2026 19:43
@sisyphus-dev-ai
fix(core): compact repeated message diff events
e2772c8
Avoid re-appending a summarized user message's full patch array in each message.updated.1 event. Preserve the first durable diff event and projection value for replay compatibility while compacting later updates.\n\nThe focused SQLite regression fixture reduces the repeated event row from 262515 bytes to 284 bytes (99.89%).

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
docs: document message diff compaction
4c72519
Record the chosen replay-compatible event compaction, failing-before and passing-after output, SQLite byte measurement, verification, and residual risk.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
fix(core): preserve changed message diff events
182fd74
Compact only patch bodies when SQLite-normalized summary diffs exactly match the projected value. Changed summaries retain their full new patches, and replay restores compact event patches without decoding every projection.\n\nThe real summarize regression covers changed diffs and fresh replay. The repeated fixture event falls from 262515 bytes to 360 bytes (99.86%).

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
docs: remove tracked fix report
7ea3cb8
Keep the requested evidence report as a local untracked deliverable rather than adding it to the upstream branch.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
revert(core): remove unsafe diff compaction
a54d20b
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
feat(schema): version message diff events
3889c3e
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
feat(core): store per-message diff projections
c0035cc
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
feat(core): project durable message diffs
52502a5
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
feat(opencode): publish dedicated turn diff events
3086653
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
feat(app): hydrate live message diff events
35dc185
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
feat(tui): apply live message diff events
a338ddc
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
refactor(core): remove V2 message event compatibility
ab7642b
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
fix(opencode): deduplicate unchanged turn diffs
9ac44ed
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
fix(opencode): hydrate message diff reads
c67c2c8
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
refactor(app): remove V2 diff event reducer
d45c35d
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
fix(app): project live turn diffs
6a17390
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
fix(tui): retain hydrated turn diffs
7136666
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
fix(share): forward summarized turn diffs
1d7b9b5
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
chore(sdk): regenerate event types
00b1fcd
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
@sisyphus-dev-ai
test(schema): repair stale event inventory assertions
c16eba1
@sisyphus-dev-ai
fix(core): sync and guard message diff projection
c079891
@sisyphus-dev-ai
fix(opencode): preserve replayable baseline for imported turn diffs
d54a4c0
@sisyphus-dev-ai
fix(app): remove unreachable directory diff handler
5cb8f61
@sisyphus-dev-ai
fix(tui): buffer turn diffs across first hydration
9ea4d5f
@sisyphus-dev-ai
test: cover diff replacement, removal, cascade, sharing and hydration
1318f01
@sisyphus-dev-ai
fix(opencode): skip diff share hydration when the session is unshared
8b6fa24
@sisyphus-dev-ai
fix(core): retire stale message diff on summary-less replacement
d0dca90
@sisyphus-dev-ai
fix(opencode): persist imported diff baseline without discarding comp…
8b3d14d
…uted diff
@sisyphus-dev-ai
fix(tui): bound and invalidate buffered hydration diffs
933c4e8
@sisyphus-dev-ai
fix(app): buffer diff replacements across in-flight message loads
1c09ea0
AceRothstein71 added 7 commits September 19, 2026 01:41
@AceRothstein71
fix(opencode,core): close audit-v15 wave L remote/attached-option fin…
7b7e70a
…dings
@AceRothstein71
fix(opencode): close audit-v16 wave M-C anchor-form ref retention
2b95854
@AceRothstein71
fix(opencode): close audit-v16 wave M-B reusable-reload disposer bound
13f3368
@AceRothstein71
fix(opencode,core): close audit-v16 wave M-A shell findings
9c5eb44
@AceRothstein71
fix(opencode): close audit-v17 wave N shell findings
264134c
@AceRothstein71
fix(opencode): close audit-v18 wave O shell findings
f50f02b
@AceRothstein71
fix(opencode): close audit-v19 wave P shell findings
7063bdd
This was referenced Sep 19, 2026
Perf: cut worker-thread saturation/CPU from session diffs, snapshots, SQLite contention, and event fanout (PR #48638 series) #49974
Closed
Security: fail-closed shell classifier hardening (waves H-L of PR #48638 series) #49975
Closed
Security: shell classifier convergence waves M-P under v16-v20 adversarial audits (PR #48638 series) #49976
Closed
Lifecycle: reload/teardown safety for instances (bounded drains, interrupt-safe claims, reusable-reload wedge fix) #49977
Closed
MCP/schema: validation hardening + anchor-form $ref retention (PR #48638 series) #49978
Closed
Server/SSE + event/db hardening (audit-v7 and wave B findings) #49979
Closed
Tooling: fork-follow autopatcher (upstream + patch-replay, staging gate, rollback) - contribution proposal #49980
Closed
@AceRothstein71

AceRothstein71 commented Sep 19, 2026

Copy link
Copy Markdown
Author

Tracking issues created for this integration branch (stacked-PR plan): #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. Each issue carries its per-subsystem commit list; this PR is intended to be split into the corresponding stacked PRs with the integration branch kept as reference. Original tracker: #49565.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Sep 19, 2026
bash tool: backslash-escaped spaces make in-project paths look external (external_directory prompt / hard deny under "*": deny) #49671
Closed
Durable event table bloats from repeated turn diff payloads #48641
Closed
Snapshot git transactions race across processes and a stale index.lock permanently wedges snapshots #48848
Closed
shell: bare redirect bypasses the permission check (scanner returns no commands) #49948
Closed
Concurrent runs can fail on shared snapshot gc.pid.lock #49190
Closed
1837620622 and others added 5 commits September 19, 2026 16:18
@1837620622 @AceRothstein71
fix(session): recover stale encrypted reasoning
3d6de47
Retry once after stripping caller-bound reasoning.encrypted_content when the
provider rejects it, matching overflow recovery.

Adapted from PR anomalyco#48918 by 传康Kk <[email protected]>.
Fork scope: core runner + @opencode-ai/llm classifier + tests only. The
packages/opencode legacy processor path from the PR is intentionally excluded
(heavily diverged in this fork and out of Wave Q scope).
Type-only adaptation: SessionStaleReasoning.stripOpenaiReplay is typed against
the schema ProviderMetadata shape to satisfy this fork's tsgo.
@1837620622 @AceRothstein71
fix(opencode): recover stale encrypted reasoning on the V1 path
b25cd68
Retry once after stripping caller-bound reasoning.encrypted_content when the
provider rejects it, matching overflow recovery. This ports the packages/opencode
side of PR anomalyco#48918 (server handler -> SessionPrompt -> SessionProcessor -> llm)
that Wave Q intentionally left out.

Adapted from PR anomalyco#48918 by 传康Kk <[email protected]> (V1-path port, Wave R).
Fork scope: provider/error.ts classifier, session/stale-reasoning.ts sanitizer,
session/processor.ts retry-once hook, message-v2.ts serialization, and tests.
Adaptation: processor.ts diverged ~+329 lines from the merge-base, so the hook
was mirrored onto the fork's retry/backoff + finalizeRetryInflight structure
instead of cherry-picking. outputStarted()/recoverStaleReasoning follow upstream.
@AceRothstein71
Merge upstream dev (1d6c3c0) into session-diff-events
1cc600e
Resolve bun.lock + packages/sdk/js/package.json drift: take upstream (sdk 1.18.32) and keep the opencode ajv devDependency. Restores clean patch replay for the autopatcher.
@AceRothstein71
fix(opencode): coalesce concurrent snapshot track captures
3611f6d
Parallel agents in one worktree call track() at every step boundary and each capture is a full stage + write-tree pass behind the per-gitdir lock. Callers now share a queued capture (taken after they asked) and a burst of N costs at most two captures. 20 parallel track() on a 2000-file worktree: 1044/517/403 ms -> 75/57/63 ms.
@AceRothstein71
fix(core): rotate the shared opencode.log once it exceeds 64 MiB
3509752
Every opencode process appends to one log file with no cap (679 MB observed). Rotate to opencode.log.1 at logger startup, best effort so a concurrent rotation or read-only dir never blocks logging.
@monody0007 monody0007 mentioned this pull request Sep 30, 2026
fix(core): stop republishing summary diffs into durable event snapshots #50106
Closed
3 tasks done
@gorredinesh21 gorredinesh21 mentioned this pull request Oct 1, 2026
refactor(core): cache compiled wildcard pattern regexes #52318
Closed
3 of 6 tasks
@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thdxr thdxr closed this Oct 10, 2026
@marcusrbrown marcusrbrown mentioned this pull request Oct 23, 2026
Long-lived opencode serve grows with every repo it serves; recycle it when idle fro-bot/agent#1923
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Hona Hona Awaiting requested review from Hona
@Brendonovich Brendonovich Awaiting requested review from Brendonovich

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Durable event table bloats from repeated turn diff payloads snapshot.diffFull hangs process and exhausts memory on large generated text files opencode.db grows to ~9 GB due to enormous message.updated.1 event snapshots snapshot: corrupt index causes repeated capture failures and unresponsive service Performance: inefficient O(N^2) ripgrep callback
Snapshot git transactions race across processes and a stale index.lock permanently wedges snapshots bug: workspace diff passes --unified=2147483647, re-emitting the file once per hunk (>1 GB patch text, ~11 s CPU per filesystem event) Perf: cut worker-thread saturation/CPU from session diffs, snapshots, SQLite contention, and event fanout (PR #48638 series)

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@AceRothstein71 @thdxr @sisyphus-dev-ai @JacobNWolf @1837620622
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.