Skip to content

perf(web): avoid repeated terminal metadata scans - #248

Open
leoisadev1 wants to merge 2 commits into
mainfrom
perf/web-terminal-metadata-index
Open

perf(web): avoid repeated terminal metadata scans#248
leoisadev1 wants to merge 2 commits into
mainfrom
perf/web-terminal-metadata-index

Conversation

@leoisadev1

Copy link
Copy Markdown
Member

Problem

Each sidebar and status-indicator consumer rescanned terminal metadata, rebuilt session wrappers, and resorted IDs. That repeats for every thread that only needs running-subprocess IDs.

Changes

Build one ordered metadata index per immutable snapshot. Reuse unchanged session wrappers and thread groups, with separate environment targets. Attach subscriptions stay as they were.

Adapted from pingdotgg#9747.

Scope

This PR is terminal metadata indexing only.

Covered here:

Still assigned to this handoff, in later PRs:

Verification

  • vp test run apps/web/src/state/terminalSessions.test.ts: 6 passed.
  • vp lint on the two files: clean.

Implemented and verified by Grok 4.6 High in Grok Build via Orca.

Index one immutable metadata snapshot once, then reuse session wrappers
and thread groups across consumers. Environment targets stay separate.
@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
akeru-bot-landing Skipped Skipped Sep 10, 2026 6:26pm UTC

Request Review

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 10, 2026
@greptile-apps

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown

Greptile Summary

The terminal-session derivation changes optimize metadata indexing and memoized environment/thread views while preserving terminal ordering, environment isolation, stable empty results, and structural reuse.

Confidence Score: 5/5

Safe to merge.

There are no outstanding findings.

Reviews (2): Last reviewed commit: "Merge branch 'main' into perf/web-termin..." | Re-trigger Greptile

@leoisadev1

Copy link
Copy Markdown
Member Author

This is Leo's agent. Independent review of e2355ba: 50 focused selector, terminal-stream, drawer and status tests pass. I have not found a correctness defect in the cache. However, I cannot establish the advertised performance benefit on the current product path: AppSidebarLayout renders BotRosterSidebar; useThreadRunningTerminalIds is used by the retained Sidebar, LegacySidebar and otherwise-unused ThreadRowTrailingStatus; useAttachedTerminalSession is used by ThreadTerminalDrawer, whose component has no production caller found. SettingsFontPreviews imports only its theme helper. Please identify the supported live caller before this is accepted as a performance port. Do not revive legacy UI or expand the feature just to exercise this optimization. This is a reachability/port-fit hold, not a claim that the passing tests prove a current-app speedup.

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

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant