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(client): store a session's messages only once its transcript is asked for by Hona · Pull Request #66204 · anomalyco/opencode

Conversation

@Hona

@Hona Hona commented Nov 24, 2026 •
edited by opencodejr Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Summary

The client stored every message that a session's events brought, whether or not anything had asked for that session's transcript. With agents at work the store grew by 18 to 26 MB of messages an hour (as JSON). In a sample with the owner's tabs, 93% of the growth belonged to subagent sessions that nobody opened. Nothing read those lists, and nothing freed them while a tab of their family stayed open. Now a session stores its messages only once its transcript was asked for.

flowchart TD
  E["An event of a session"] --> Q{"Transcript asked for?<br/>a read ran or runs, or this client<br/>created the session or sent into it"}
  Q -->|yes| S["Stored, as before"]
  Q -->|no| R{"Starts a step?"}
  R -->|yes| ONE["The running step alone,<br/>until the step or the run ends"]
  R -->|no| DROP["Not stored"]
  O["The session is opened"] --> P["Its newest page is read"]
  P --> M["The page, with the step that events built<br/>and what arrived after the page"]
Loading

Changes

  • opened (packages/client/src/solid/data.ts): the sessions whose transcript was asked for. session.message.sync, session.create, session.prompt and session.compact add to it; eviction and deletion remove from it. Only these store what their events bring.
  • What any other session holds: the assistant message of the step that runs now. The TUI's permission prompt reads the call that asks from it (packages/tui/src/routes/session/permission.tsx), also for a subagent that was never opened. The list goes when the step ends, and when the run ends.
  • The first read after opening joins the page with what events built. A message that the page has as still running stays as events built it, since its later events already landed; messages after the last one the page has follow the page; older ones are left to the cursor. After a reconnect the page wins, because events may have been missed.
  • session.created no longer marks the transcript of a session nobody opened as read, so opening it reads its newest page. For a session this client created, events stay the whole transcript.
  • Tab strip (packages/app/src/shell/titlebar/tab-strip.tsx): a tab knew that its session was prompted from a user message in the store. For a tab nobody looked at it now goes by the record (time.busy) and by a prompt that waits in the inbox. One visible change: a tab that was never looked at, of a session that has run, is listed under Recently closed after it closes. Before, that depended on whether events with its prompt had arrived in this window.
  • A child's view (packages/app/src/session/timeline/controller.tsx) asks for its parent's transcript whatever the store holds of the parent, which may now be one step.
  • Native CLI parity: the fold fixture is regenerated, and the 11 cases that now differ are a recorded deviation (parity/deviations/O89-unopened-transcript.md). The Rust store is unchanged and still stores every message.

Stored lists and messages

Three sessions nobody opened; each gets a prompt, a step with text and a tool call, a second step, and the end of its run (15 events each).

dev This PR
Lists / messages while the first step runs 3 / 6 3 / 3
Lists / messages after the runs end 3 / 12 0 / 0

Memory of the page

33 minutes of the live event stream, recorded (24,138 events of 41 sessions in 8 families), replayed at 30 times its speed into a lab page on a frozen copy of the server. JavaScript heap after a forced collection (CDP), two runs each.

The page shows Heap grew on dev With this PR
The root of the busiest family, after a look at the root of the next one 22.9, 22.6 MB 8.6, 8.7 MB
A session that is not in the recording 10.0, 10.0 MB 5.1, 5.1 MB
The same page with nothing sent 1.2 MB 1.2 MB
  • It is 33 minutes, not the hour I meant to record: the machine was restarted while the recorder ran.
  • What still grows with this PR in the first row is the two sessions the page opened, which store everything as before.
  • Bun's heap, earlier, with the owner's tabs: 31 lists, 362 messages and 5.3 MB of JSON after 12 minutes, 26 of the lists for subagents nobody opened.

Who reads a message list

  • The app: 12 readers. 10 read the session on screen. The child view reads its parent, and loads it when needed (changed, above). The tab strip reads each tab's own session (changed, above).
  • The TUI: the session route, its dialogs, the sidebar and the footer read the session on screen, which the route reads first. Other tabs are read ahead (session-tabs.tsx), which opens them. The permission prompt reads a descendant's running step, which is kept.
  • Plugins (gui-plugins: context, sources, btw, debug) read the mounted session.
  • The CLI, the mini TUI and ACP read messages through the API, not through this store.
  • Subagent rows, notifications, the inbox and the activity capsule read records, statuses, jobs and the inbox, which are stored for every session as before.

Why retention freed nothing

  • createSessionRetention keeps the family of every open tab and of the three sessions viewed last, and evicts every other family. A subagent is in its root's family. In the sample all 614 known sessions were below two open tabs, so the effect ran 41 times and had nothing to evict.
  • That follows from the first fault. Retention bounds the transcripts this window opened, by family. It was never the bound for lists that nobody asked for. With this PR a list exists only when it was asked for.
  • Left as it is: a subagent transcript that was opened once stays for as long as a tab of its family is open. In the sample that was 3% of the growth.

Next to #66035 and #66168

Scratch merges with rerere off, not pushed.

  • fix(app): keep loaded history when the transcript is read again #66035 (keep-history-resync): 7 conflicts in data.ts, each where both sides add at one place; both sides stay. Three points need a decision, and with them the client tests pass:
    • a session nobody opened is not anchored at session.created, since its transcript is not stored from its start;
    • in message.sync, its kept pages go before the fetched page, and this PR's join applies to the fetched page and after;
    • two rows of its test table ("that events alone built", "built since another client created the session") expect the transcript that events built. Nothing is stored for those sessions now, so both become a plain first read.
  • fix(app): order messages by their place in the transcript, not by their IDs #66168 (order-by-sequence): data.ts merges without a conflict. The conflicts are in the parity oracle's allow list, where both add entries, and in its generated fixture, which is regenerated.

No flag

  • By the rule in the root AGENTS.md this is a fix: no new behaviour for a reader apart from the Recently closed line above.
  • A flag is read with Flag.enabled in Core, and client code may not depend on Core. No client code reads a flag today, so a flag here means a new option on createData and wiring in the app and the TUI: more code and more risk than the change. If a switch is wanted, that option is where it goes.

Not in this PR

  • The Rust client still stores every message (deviation recorded).
  • session.tool.progress carries the whole output so far each time. In 11 minutes one session sent 2,078 of them, 261 MB of JSON, to every client. The store keeps only the last one, so it is not this fault, but every window parses all of it.

Regression tests

  • packages/client/test/solid-unopened.test.ts, "sessions nobody opened store the step each runs, and nothing once their runs end": the counts in the table. On dev: 3 lists and 12 messages after the runs, where 0 and 0 are expected.
  • Same file, "a session (made while connected | known before) that is opened later shows its newest page and then follows its events": the page is read while a step runs. On dev the first case reads nothing (reads: 0, more: false), and the second shows the tool as running after its result arrived.
  • Same file, "the step of a session nobody opened (is trusted over the page while the stream held | gives way to the page after a reconnect)", and "a first read after more than a page of events keeps the page's order".
  • Same file, "a session that is open stores every message of its run": unchanged behaviour.
  • packages/app/e2e/regression/tabs.spec.ts, "a tab that was never looked at is offered again after it closes": on dev the menu lists nothing.

Added by the opencode bot (AI-generated).

Fixes #63360

Related: #61313

Public API: @opencode/client: data.session.message.list(id) holds at most the running step for sessions not yet opened via message.sync/create/prompt (no signature change; readers of other sessions must sync first)

Sorry, something went wrong.

Uh oh!

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

All reactions
Hona added 2 commits November 25, 2026 09:08
@Hona
fix(client): store a session's messages only once its transcript is a…
569d7d5
…sked for
@Hona
docs(app): say what the client stores of a session nobody opened
f04d29b
opencodejr[bot]
opencodejr Bot reviewed Nov 24, 2026
View reviewed changes

@opencodejr opencodejr 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.

The change looks sound, and I found nothing that blocks it.

How I checked

  • New tests on dev: solid-unopened.test.ts fails 5 of its 7 cases on dev, including the store-growth case and the opened-later cases.
  • With this PR: the whole client suite passes, 276 tests.
  • Type checks: tsc --noEmit is clean for packages/client and packages/app.
  • TUI: a session this client created still shows its whole transcript (simulated model).
  • Readers: every message.list reader in the app, the TUI and gui-plugins reads the session on screen after message.sync. The exceptions are the two you changed (the child view's parent and the tab strip) and the TUI permission prompt, which uses message.get for the running step that is kept.

Public API: no signatures change. data.session.message.list(id) in @opencode/client now holds at most the running step for a session this client hasn't opened. Outside code that reads another session's list has to call message.sync(id) first. Signature-compatible, but such readers see less than before.

No further concerns.

Fixes #63360
Related: #61313

Sorry, something went wrong.

Uh oh!

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

All reactions
@Hona
test(tui): ask for a session's transcript before its events in the da…
bcee4b5
…ta tests
opencodejr[bot]
opencodejr Bot reviewed Nov 24, 2026
View reviewed changes

@opencodejr opencodejr 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.

The new commit only touches tests, and it fixes the TUI tests that my last review missed (I hadn't run packages/tui). With the test file from f04d29b, 8 of the 50 tests in packages/tui/test/cli/tui/data.test.tsx fail against this PR. With your update all 50 pass, and the client suite still passes (276 tests).

The updated tests ask for each session's transcript before sending its events, as the session route does when it opens. Where events must land during that first read, a promise the test controls holds the read open instead of a timer.

Public API: unchanged since my last review (message.list holds at most the running step for a session this client hasn't opened).

I have no new concerns.

Sorry, something went wrong.

Uh oh!

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

All reactions

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

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.

tui: keeps every subagent's full transcript loaded while the root session is open

Uh oh!

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

1 participant

@Hona
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.