anomalyco / anomalyco/opencode

[BUG] Old sessions get bulk-updated time_updated timestamps, breaking recency ordering

Open
#49,302 3 comments 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Sep 16, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
Avg merge
7h 2m
Merged PRs (30d)
384

Description

Description

Old sessions in the SQLite database are having their session.time_updated timestamps overwritten in bulk with the current time.

This breaks any session list or frontend that relies on time_updated for recency ordering.

I noticed the problem because many old sessions suddenly appeared as recently updated. Querying ~/.local/share/opencode/opencode.db confirmed that this is not only a UI issue: the timestamps in the session table itself are being modified.

For example:

SELECT
  datetime(time_updated/1000,'unixepoch','localtime') AS updated,
  COUNT(*) AS n
FROM session
GROUP BY time_updated/1000
ORDER BY time_updated/1000 DESC
LIMIT 10;

produced:

2026-09-16 09:43:25|59
2026-09-16 09:39:33|40
2026-09-16 09:39:32|17
2026-09-14 12:37:00|1
...

A minute later, dozens of those sessions were updated again to exactly the same timestamp (2026-09-16 09:44:25).

Some affected sessions were originally created weeks earlier, for example:

created              updated
-------------------  -------------------
2026-08-24 11:48:07  2026-09-16 09:44:25
2026-08-27 14:34:56  2026-09-16 09:44:25
2026-09-03 13:53:24  2026-09-16 09:44:25
2026-09-10 09:50:18  2026-09-16 09:44:25
2026-09-14 08:37:33  2026-09-16 09:44:25

These sessions were not actually active at that time.

This looks closely related to:

  • #25392
  • #27048
  • #21078

Those issues are closed, but the behavior is still reproducible on my current installation.

Expected behavior: time_updated should reflect actual session activity, not background reindexing/project loading/metadata operations.

Actual behavior: dozens of old session rows receive nearly identical current timestamps in bulk, sometimes repeatedly.

Plugins

OpenChamber frontend connected to OpenCode; SAIA plugin installed

OpenCode version

1.18.31

Steps to reproduce
  1. Run OpenCode with an existing database containing older sessions.
  2. Use the OpenCode server normally (in my case through OpenChamber).
  3. Inspect session timestamps:
sqlite3 ~/.local/share/opencode/opencode.db "
SELECT
  datetime(time_updated/1000,'unixepoch','localtime'),
  COUNT(*)
FROM session
GROUP BY time_updated/1000
ORDER BY time_updated DESC
LIMIT 10;
"
  1. Observe dozens of unrelated old sessions receiving the same current time_updated timestamp.
  2. Repeat shortly afterwards; another bulk timestamp update may occur.
Operating System

Ubuntu 26.04.1 LTS

Terminal

bash

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.