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 — refactor(snapshot): store unified patches in file diffs by thdxr · Pull Request #21244 · anomalyco/opencode

Conversation

@thdxr

@thdxr thdxr commented Apr 6, 2026

Copy link
Copy Markdown
Member

Summary

  • store snapshot and edit/apply-patch file metadata as plain unified patches in patch fields instead of full before/after content
  • keep VCS diffs on a dedicated VcsFileDiff schema so review surfaces can still use full file contents independently of snapshot metadata
  • regenerate the v2 SDK types and update the snapshot/apply-patch tests plus TUI apply-patch rendering to match the new metadata shape

Testing

  • bun test test/snapshot/snapshot.test.ts
  • bun test test/tool/apply_patch.test.ts
  • bun typecheck (packages/sdk/js)
  • bun typecheck (packages/app)

Notes

  • repo typecheck was intentionally bypassed on push; packages/ui still imports the old SDK FileDiff name and needs a separate follow-up

Sorry, something went wrong.

Uh oh!

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

All reactions
@thdxr
refactor(snapshot): store unified patches in file diffs
aac9bb3
greptile-apps[bot]
greptile-apps Bot reviewed Apr 6, 2026
View reviewed changes

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Sorry, something went wrong.

Uh oh!

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

All reactions
@github-actions github-actions Bot added the Vouched label Apr 6, 2026
thdxr and others added 2 commits April 6, 2026 20:49
@thdxr
fix(opencode): align share and patch test diff types
e2e32b3
@adamdotdevin
chore(app): update desktop diffs, remove session changes (#21360)
b9c30ad
@adamdotdevin
adamdotdevin self-requested a review as a code owner April 7, 2026 20:52
@thdxr
Merge remote-tracking branch 'origin/dev' into feat/snapshot-patch-fi…
ba3f408
…lediff

# Conflicts:
#	packages/app/src/pages/session.tsx
@thdxr
thdxr enabled auto-merge (squash) April 7, 2026 23:48
@thdxr
thdxr disabled auto-merge April 7, 2026 23:48
@thdxr
thdxr merged commit b7fab49 into dev Apr 7, 2026
10 of 11 checks passed

Uh oh!

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

@thdxr
thdxr deleted the feat/snapshot-patch-filediff branch April 7, 2026 23:48
NicholasDominici added a commit to jairad26/opencode that referenced this pull request Apr 9, 2026
@NicholasDominici @rekram1-node
@opencode-agent @jlongster @fwang @gitpush-gitpaid @nexxeln @thdxr @adamdotdevin @ariane-emory @kitlangton @altendky opencode @Brendonovich @OpeOginni @vglafirov @nonbanana @Hona @egze @simonklee
Pr 41 (#42)
7e65272
* fix: bump openrouter ai sdk pkg to fix openrouter issues (anomalyco#21242)

* chore: update nix node_modules hashes

* chore: remove ai-sdk/provider-utils patch and update pkg (anomalyco#21245)

* chore: update nix node_modules hashes

* chore: bump anthropic ai sdk pkg, delete patch (anomalyco#21247)

* refactor(core): add full http proxy and change workspace adaptor interface (anomalyco#21239)

* go: add mimo

* feat: add --dangerously-skip-permissions flag to opencode run (anomalyco#21266)

* chore: update nix node_modules hashes

* feat(opencode): Add PDF attachment Drag and Drop (anomalyco#16926)

Co-authored-by: Aiden Cline <[email protected]>
Co-authored-by: Aiden Cline <[email protected]>

* feat(app): show full names on composer attachment chips (anomalyco#21306)

* style(app): redesign jump-to-bottom button per figma spec (anomalyco#21313)

* Move auto-accept permissions to settings (anomalyco#21308)

* go: support coupon

* fix(opencode): keep user message variants scoped to model (anomalyco#21332)

* chore: generate

* chore: update web stats

* feat(app): better subagent experience (anomalyco#20708)

* refactor(core): support multiple event streams in worker and remove workspaces from plugin api (anomalyco#21348)

* fix(tui): use sentence case for theme mode command palette items (anomalyco#21192)

Co-authored-by: Aiden Cline <[email protected]>

* fix: ensure the alibaba provider errors are retried (anomalyco#21355)

* fix(opencode): improve console login transport errors (anomalyco#21350)

* chore: generate

* feat(tui): allow variant_list keybind for the "Switch model variant" command (anomalyco#21185)

Co-authored-by: Aiden Cline <[email protected]>

* test: disable GPG signing in test fixtures (anomalyco#20386)

* fix(opencode): clear webfetch timeouts on failed fetches (anomalyco#21378)

* feat(opencode): add OTLP observability support (anomalyco#21387)

* zen: glm5.1 doc

* zen: glm5.1 doc

* go: glm5.1

* core: refactor tool system to remove agent context from initialization (anomalyco#21052)

* refactor(snapshot): store unified patches in file diffs (anomalyco#21244)

Co-authored-by: Adam <[email protected]>

* chore: generate

* release: v1.4.0

* chore: update nix node_modules hashes

* fix(tui): simplify console org display (anomalyco#21339)

Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>

* ui: fix sticky session diffs header (anomalyco#21486)

* test: update webfetch test (anomalyco#21398)

Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>

* fix: ensure that /providers list and shell endpoints are correctly typed in sdk and openapi schema (anomalyco#21543)

* fix(app): patch tool diff rendering

* fix(app): diff list normalization

* fix: dont show invalid variants for BP (anomalyco#21555)

* tweak: separate ModelsDev.Model and Config model schemas (anomalyco#21561)

* refactor(effect): build task tool from agent services (anomalyco#21017)

* fix(app): skip url password setting for same-origin server and web app (anomalyco#19923)

* fix: propagate abort signal to inline read tool (anomalyco#21584)

* refactor(effect): inline session processor interrupt cleanup (anomalyco#21593)

* feat(llm): integrate GitLab DWS tool approval with permission system (anomalyco#19955)

Co-authored-by: Aiden Cline <[email protected]>

* chore: update nix node_modules hashes

* fix(lsp): remove CMakeLists.txt and Makefile from clangd root markers (anomalyco#21466)

* Remove CLI from electron app (anomalyco#17803)

Co-authored-by: LukeParkerDev <[email protected]>

* chore: generate

* chore: update nix node_modules hashes

* feat: add opencode go upsell modal when limits are hit (anomalyco#21583)

Co-authored-by: Frank <[email protected]>

* release: v1.4.1

* app: remove min loading duration (anomalyco#21655)

* fix: preserve interrupted bash output in tool results (anomalyco#21598)

* fix: preserve text part timing in session processor (anomalyco#21691)

* refactor(effect): drop shell abort signals from runner (anomalyco#21599)

* refactor: fix tool call state handling and clean up imports (anomalyco#21709)

* release: v1.4.2

* feat(mcp): add OAuth redirect URI configuration for MCP servers (anomalyco#21385)

Co-authored-by: Aiden Cline <[email protected]>

* chore: generate

* fix(tui): restore hidden session scrollbar default (anomalyco#20947)

* feat: add support for fast modes for claude and gpt models (that support it) (anomalyco#21706)

* opencode: lazy-load top-level CLI commands

The CLI imports every top-level command before argument parsing has
decided which handler will run. This makes simple invocations pay for
the full command graph up front and slows down the default startup path.

Parse the root argv first and load only the command module that matches
the selected top-level command. Keep falling back to the default TUI
path for non-command positionals, and preserve root help, version and
completion handling

* delete unused withALS method (anomalyco#21723)

* Revert "opencode: lazy-load top-level CLI commands" (anomalyco#21726)

* fix(effect): suspend agent default layer construction (anomalyco#21732)

---------

Co-authored-by: Aiden Cline <[email protected]>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: James Long <[email protected]>
Co-authored-by: Frank <[email protected]>
Co-authored-by: gitpush-gitpaid <[email protected]>
Co-authored-by: Aiden Cline <[email protected]>
Co-authored-by: Shoubhit Dash <[email protected]>
Co-authored-by: Dax <[email protected]>
Co-authored-by: Adam <[email protected]>
Co-authored-by: Ariane Emory <[email protected]>
Co-authored-by: Kit Langton <[email protected]>
Co-authored-by: Kyle Altendorf <[email protected]>
Co-authored-by: opencode <[email protected]>
Co-authored-by: Brendan Allan <[email protected]>
Co-authored-by: OpeOginni <[email protected]>
Co-authored-by: Vladimir Glafirov <[email protected]>
Co-authored-by: Cho HyeonJong <[email protected]>
Co-authored-by: LukeParkerDev <[email protected]>
Co-authored-by: Aleksandr Lossenko <[email protected]>
Co-authored-by: Simon Klee <[email protected]>
@achin90 achin90 mentioned this pull request Apr 10, 2026
DispatchTUI prtest achin90/Dispatch#3
Closed
This was referenced Apr 13, 2026
app: limit diffs to 4 lines of context instead of full file #22268
Closed
app: replace parsePatchFiles with parseDiffFromFile #22270
Merged
mrsimpson pushed a commit to mrsimpson/opencode that referenced this pull request Apr 14, 2026
@thdxr @adamdotdevin @mrsimpson
refactor(snapshot): store unified patches in file diffs (anomalyco#21244
01e8e0f
)

Co-authored-by: Adam <[email protected]>
@sim590 sim590 mentioned this pull request Apr 19, 2026
perf: diff pipeline causes severe UI lag on desktop — full-context patches + synchronous parsing on main thread #22650
Closed
coleleavitt added a commit to coleleavitt/opencode that referenced this pull request Apr 21, 2026
@coleleavitt
fix(session): cap FileDiff before/after and drop eager TUI diff load (a…
4f5e0ae
…nomalyco#20695)

Live-caught crash @ 2026-04-21T00:17:07Z: RSS=4.03 GB after 60 s of runtime
on session resume. Our auto-heap-snapshot fired and produced a 646 MB + 413 MB
pair before a bun int3 assertion killed the process 8 min later.

Root cause: /session/<id>/diff is fetched 45 times at TUI startup (once per
session in sidebar) and each fetch loads a Snapshot.FileDiff[] with full
before/after file contents. Disk measured 6.5 GB across 7438 session_diff
files, largest 2.1 GB with 780 before/after string pairs.

Per Oracle recommendation:

1. sync.tsx: drop session.diff() from the per-session eager Promise.all;
   bus events still populate the store reactively when diffs actually change.
   The TUI itself never renders diffs (only the plugin API reads them), so
   there's no user-visible regression.

2. Snapshot.capFileDiffs(): replace before/after with empty strings when
   either field exceeds 256 KB. UI (file.tsx large() threshold @ 500 K chars)
   already disables line-level diffing past that anyway; empty strings
   integrate cleanly with session-review.tsx's beforeText().length === 0
   added/deleted check.

3. Applied at write time in summary.ts:122 + revert.ts:78 BEFORE both
   storage.write() and bus.publish() so cached UI state never sees the
   uncapped form.

4. Applied at read time in Session.diff() + SessionSummary.diff() so the
   existing 6.5 GB of legacy data on disk is capped progressively on first
   access without needing a migration script.

Skipped PR anomalyco#21244 (unified-patch storage): the @pierre/diffs FileDiff
component requires full before/after strings, so reconstructing at render
time would restore the memory spike. Capping at the source is simpler,
doesn't diverge further from upstream, and remains compatible with a future
anomalyco#21244 port.

Ref: anomalyco#20695
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
@thdxr @adamdotdevin
refactor(snapshot): store unified patches in file diffs (anomalyco#21244
7e56d44
)

Co-authored-by: Adam <[email protected]>
MarsQiu007 referenced this pull request in MarsQiu007/openNovel Jul 31, 2026
@thdxr @adamdotdevin
refactor(snapshot): store unified patches in file diffs (#21244)
08eb48e
Co-authored-by: Adam <[email protected]>
@ksy90101 ksy90101 mentioned this pull request Oct 19, 2026
fix: upstream 메모리 수정 3건 포팅 (patch 저장, bash 출력 tail, 파스 트리 해제) team-monolith-product/enk-opencode#300
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adamdotdevin adamdotdevin Awaiting requested review from adamdotdevin
1 more reviewer
@greptile-apps greptile-apps[bot] greptile-apps[bot] left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

No one assigned

Labels

Vouched

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

2 participants

@thdxr @adamdotdevin
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.