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(app,client): keep hidden transcripts to their tail under a size budget by kitlangton · Pull Request #58491 · anomalyco/opencode

Conversation

@kitlangton

@kitlangton kitlangton commented Oct 23, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Stacked on #57025. This PR targets app-session-evict and should be retargeted to dev once #57025 merges.

What it does

#57025 keeps open tabs and recent sessions whole, with no limit on how many or how large they are, even though only one session is ever on screen. With this change, hidden sessions keep only their latest messages, and their total size has a budget. Switching to a tab is still instant. Scrolling up loads older messages from the server through the existing "load earlier" path.

How it works

  1. The data layer now remembers the server cursor for the oldest message of each page it loads (message.sync and loadMore).
  2. The new session.message.trim(id, tail) cuts at the newest loaded page boundary that still leaves at least tail messages, and restores that page's cursor. more()/loadMore() then refetch exactly what was dropped. If no page boundary lies within twice the tail (history that grew from live events), it keeps the last tail messages, clears the cursor and invalidates the read, so the next view refetches as many newest messages as it still shows (capped at the server's 200). A trim that lands while an older page is loading returns false and runs again when the page lands.
  3. createSessionRetention still picks the same families as fix(app,client): wire session transcript retention and evict background transcripts #57025 (current, open tabs, 3 recent). The visible session, its ancestors (a subagent's header and background list read the parent's transcript) and any running session stay whole. Every other retained session is trimmed to 40 messages, and trimmed again whenever background events add to it.
  4. Hidden families are walked from most to least recently viewed (open tabs never viewed come last), with sizes estimated from string length and cached by length plus first and last message id. Families past the 50 MB budget are evicted fully, as fix(app,client): wire session transcript retention and evict background transcripts #57025 already does for families outside the retained set. The family of the current session doesn't count toward the budget, and a family with a running session is neither measured nor evicted, here or outside the retained set, until it goes idle.

The desktop app and the TUI both use these defaults through the shared createSessionRetention.

Risk

Client-side cache only; the server is unchanged.

  • In the fallback case (no usable page boundary), returning to the session fetches the newest page again, the same way an evicted session reloads today. Events that arrive while that fetch is in flight can be overwritten by the response. This race already exists when an evicted session reloads.
  • A hidden idle session whose existing messages change without a new message (no known case today) keeps its old size estimate until its length or ends change.
  • After a fallback trim the cursor stays cleared until the refetch commits, so if that read fails, "load earlier" is unavailable until the next view retries it. Keeping the old cursor would page in from past the dropped messages and leave a gap.
  • Siblings of the viewed session in the same family are still trimmed. Going back to them pages older messages in on scroll.
  • Not covered: adapting to memory pressure.

Proof

Simulated with 15 open tabs, each holding 400 messages of 2,000 characters. Retained transcript size dropped from about 12.1 MB to 1.2 MB (estimated bytes; session-tail.test.ts asserts a 5× drop). I didn't measure this in the running app.

  • bun test test/context/session-tail.test.ts test/context/session-retention.test.ts (tui): 16 pass. New tests cover trimming when you leave a session, paging the dropped history back in with no gaps or extra reads, running sessions staying whole, background appends being re-trimmed (both the page-boundary cut and the fallback), a trim deferred by an in-flight page, a subagent's parent staying whole, re-measuring a transcript whose content changed at the same length, running families surviving both eviction paths, and eviction order under the budget. The four added in the second commit fail without it.
  • bun test test/cli/tui/data.test.tsx (tui): 50 pass
  • bun test test/solid-data.test.ts test/solid-eviction.test.ts test/solid-compaction.test.ts (client): 56 pass
  • bun run typecheck in packages/client, packages/tui and packages/app: clean

Sorry, something went wrong.

Uh oh!

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

All reactions
kitlangton added 2 commits October 19, 2026 01:29
@kitlangton
fix(app,client): wire session transcript retention and evict backgrou…
0745819
…nd transcripts
@kitlangton
fix(app,client): keep hidden transcripts to their tail under a size b…
6990379
…udget
@github-actions github-actions Bot added the contributor label Oct 23, 2026
@kitlangton
fix(client): keep running families and viewed ancestors whole, retry …
910d41f
…deferred trims

Size cache keys on length plus first and last id, trims deferred by a loading page run again when it lands, a fallback trim's revalidation fetches what it still shows, and the idle status and marker publish together.
Base automatically changed from app-session-evict to dev October 23, 2026 17:28
@opencodejr opencodejr Bot mentioned this pull request Nov 3, 2026
tui: transcript memory scales with the full session log, not the compaction window #61313
Open
@Osraka Osraka mentioned this pull request Nov 3, 2026
client: late history pages repopulate deleted or evicted sessions #61339
Open
@opencodejr opencodejr Bot mentioned this pull request Nov 11, 2026
tui: keeps every subagent's full transcript loaded while the root session is open #63360
Open
@github-actions

github-actions Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot closed this Nov 23, 2026
@github-actions github-actions Bot added the automated-pr-cleanup label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

automated-pr-cleanup contributor

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.

1 participant

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