Skip to content

Feat/repl long session perf#186

Merged
cukas merged 4 commits into
mainfrom
feat/repl-long-session-perf
Jun 10, 2026
Merged

Feat/repl long session perf#186
cukas merged 4 commits into
mainfrom
feat/repl-long-session-perf

Conversation

@cukas

@cukas cukas commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

No description provided.

cukas and others added 4 commits June 9, 2026 22:35
…on true reset

The shrink-detector bumped the <Static> remount key whenever the
transcript array got shorter, but a cap-spill (front-slice at 500
blocks) shrinks it too — so every spill in a long session remounted
<Static> and synchronously repainted the whole sealed region.

Carry the cause explicitly instead of inferring it from shape:
- nextStaticEpoch(epoch, cause) pure fn — only cause='reset' advances
- epoch bump moved into the single clearBlocks reset funnel
  (/clear, /clean, session reset all dispatch {type:'clear'} → here)
- <Static> key derives solely from clearEpoch; spill/append never touch it

Verified Ink's <Static> is append-only (renders items past its internal
index), so a front-slice spill needs no remount at all.

6-engine agon review: 0 blockers (review-1781036961532-9bg0c3).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
~/.agon/runs grew unbounded (once to 40k files) and the dashboard counted
it with readdirSync inside the Ink render path.

- signals/runs-store.kern: RunsStore singleton — async hydrate via
  node:fs/promises, sync zero-fs snapshot()/runCount() for render,
  debounced scheduleRefresh after recordRun, chunked auto-prune
  (keep <7d; beyond that newest 2000; hard cap 5000; never active-id
  exact-match or mtime<10min; 1h .prune-stamp cooldown doubling as the
  cross-process lock claim; in-process guard at entry)
- app-blocks.kern dashboard reads the cached snapshot only
- app.kern boot effect (1.5s, post-first-paint): hydrate → patch the
  already-rendered dashboard block in place → prune, strictly sequential
- prune diagnostic gated behind AGON_DEBUG (never writes into the TUI)

Run *directories* stay with core's existing pruneRuns; this bounds the
run-record .json files the dashboard counts.

Two 6-engine agon reviews: all important findings fixed or rejected
with verification (review-1781038273655-uq8su5 + follow-up).
Tests: runs-store 11/11; full suite 2249 green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… cache, calmer spinner

Measured on a fat-block probe session (450 x 40-line tool blocks, 8 min):
terminal stdout 101.4MB → 43.9MB (-57%), keystroke samples >100ms 14 → 4,
>50ms 16 → 6, typing p50 ~10ms unchanged at every depth.

- nativeArchiveBlockCount: maxLiveBlocks 80 → 40 — Ink rewrites the whole
  live tail every render (~15-30/s during runs), so the live window is the
  dominant stdout cost; sealed blocks render identically
- per-block row cache in buildTranscriptRows (the commit-spike killer:
  every commit re-parsed ALL ≤500 blocks): explicit ALLOWLIST of
  neighbor-independent types only — tool-call/tool-call-group stay
  uncached (coalesced groups depend on neighbors + live status);
  key = block.id + fingerprint(type, engineId, tool, status, foldedSteps,
  color, critique, position, content length+head+tail, widths, mode,
  expand flags); true LRU (hits re-insert; evict oldest 20% at 1500);
  defensive copy on return; cache cleared in the clearBlocks reset funnel
- liveSpinner/liveProgress throttle 50ms → 120ms (streamingText untouched)

Property-style tests prove cached output deep-equals a cold rebuild across
collapsed tool groups; 22 cache tests total.

6-engine agon review (review-1781041064100-187ta0): fingerprint gaps
(color/critique/position/tail), FIFO→LRU, clear-on-reset, and by-reference
return all fixed; spinner-stutter and seal-UX concerns addressed with
rationale comments.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cukas cukas merged commit c9962b5 into main Jun 10, 2026
2 checks passed
@cukas cukas deleted the feat/repl-long-session-perf branch June 10, 2026 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant