anomalyco / anomalyco/opencode

summary_additions/deletions/files always 0, summarize() never writes real values back

Open
#41,512 1 comment 1 reaction 1 assignee View on GitHub

@jlongster is already working on this.

Since Aug 10, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

The session code change metrics are always 0 in the DB, even when files are written/edited.

In packages/opencode/src/session/summary.ts, summarize() writes {additions: 0, deletions: 0, files: 0} to the session immediately, then computes diffs and stores them on the user message via updateMessage() — but never calls setSummary() again with the aggregated values.

For reference, revert.ts does it right:

summary: {
additions: diffs.reduce((sum, x) => sum + x.additions, 0),
deletions: diffs.reduce((sum, x) => sum + x.deletions, 0),
files: diffs.length,
}

Also, computeDiff() returns [] for non-git projects since Snapshot.track() returns undefined when vcs !== "git". It would be great if code changes worked without git — e.g. by diffing the write/edit tool call args directly.

VS Code, Windows 11.

Plugins

No response

OpenCode version

OpenCode v1.18.16

Steps to reproduce
  1. Open OpenCode in a non-git directory
  2. Ask it to create a file (e.g. "write a test file with 10 lines")
  3. Run: sqlite3 ~/.local/share/opencode/opencode.db "SELECT summary_additions, summary_deletions, summary_files FROM session ORDER BY time_created DESC LIMIT 1"
  4. Result: 0|0|0 despite a file being written
Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

Windows Terminal

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.