Skip to content

History per-lane cache holds two entries, so a many-lane read re-decompresses every window #34

Description

@bmethod

Source: measured while building the Agents trend column (phase 3 of #24), 2026-09-09.

Reached by: open Agents on a machine running dozens of agents. The trend column reads one history window per visible lane. Each series took between 129 milliseconds and 5.3 seconds to arrive.

laneWindow in src/store/archive.ts and src/store/history.ts each cap their per-lane cache at two entries. That size is right for the agent detail, which reads one lane. The Agents list reads every visible lane — 43 on this machine — so every call past the second evicts the entry the next call needs, and each lane decompresses and re-parses its own window from scratch.

The reader sees a trend column that fills over several seconds instead of appearing with the row.

A second, smaller cost has the same root: the loaded set is cached inside the Agents component, so leaving the screen and coming back re-reads every visible series.

Done when

  • A read of N lanes decompresses each window once, whatever N is, proved by a test that counts decompressions rather than measuring elapsed time.
  • The loaded set survives leaving and re-entering the Agents screen.
  • A test with forty lanes shows the number of store reads matching the number of visible rows, not a multiple of it.

Context

  • Location: src/store/archive.ts, src/store/history.ts, and the cache in src/ui/agents.tsx.
  • Two defects found alongside this one are already fixed in phase 3 and are not part of it: a fetch cancelling itself from a React effect cleanup, and Promise.all holding every row blank until the slowest read returned. Both were invisible to the test suite, because a fixture store answers in under a millisecond.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions