feat(tui): ambient passes read from store, not the live ring (AUR-267)#26
Merged
Conversation
Budget rollups, anomaly histories, and sub-agent child counts now query
the SQLite store via the new EventStore.listRecentEvents() instead of
iterating the 500-event React buffer. The live tail still drives the
timeline view; only the derived passes change source.
App.tsx also seeds the live tail at launch from store.listRecentEvents(
{ limit: 500 }) so the timeline isn't empty until adapter JSONL backfill
re-emits. The wrapSinkWithStore dedup guards against id collisions when
adapters do re-emit.
Adds 4 vitest cases covering desc/asc order, sinceTs filter, and limit
clamp. Full suite 368/368 (was 364).
mishanefedov
added a commit
that referenced
this pull request
May 25, 2026
#26) Budget rollups, anomaly histories, and sub-agent child counts now query the SQLite store via the new EventStore.listRecentEvents() instead of iterating the 500-event React buffer. The live tail still drives the timeline view; only the derived passes change source. App.tsx also seeds the live tail at launch from store.listRecentEvents( { limit: 500 }) so the timeline isn't empty until adapter JSONL backfill re-emits. The wrapSinkWithStore dedup guards against id collisions when adapters do re-emit. Adds 4 vitest cases covering desc/asc order, sinceTs filter, and limit clamp. Full suite 368/368 (was 364).
mishanefedov
added a commit
that referenced
this pull request
May 25, 2026
#26) Budget rollups, anomaly histories, and sub-agent child counts now query the SQLite store via the new EventStore.listRecentEvents() instead of iterating the 500-event React buffer. The live tail still drives the timeline view; only the derived passes change source. App.tsx also seeds the live tail at launch from store.listRecentEvents( { limit: 500 }) so the timeline isn't empty until adapter JSONL backfill re-emits. The wrapSinkWithStore dedup guards against id collisions when adapters do re-emit. Adds 4 vitest cases covering desc/asc order, sinceTs filter, and limit clamp. Full suite 368/368 (was 364).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Linear: AUR-267
Summary
The TUI's reducer already kept a 500-event ring (
MAX_EVENTS = 500insrc/ui/state.ts), but the ambient passes computed from it (computeBudgetStatus, anomaly scoring, sub-agent child counts) were therefore also capped at 500. That made budget rollups undercount on busy days and anomaly histories shallow.This PR keeps the reducer / live tail unchanged (it still drives the timeline view) and switches the ambient passes to source from the SQLite store via a new
EventStore.listRecentEvents()method:childCountByAgentId: queries the last 10k events.store.listRecentEvents({ limit: 500 })so the timeline isn't empty before adapter JSONL backfill re-emits.wrapSinkWithStorededup handles any id collisions.When
store === null(e.g. a read-only$HOME), all four passes fall back tostate.eventsso the TUI remains usable.Acceptance criteria
state.eventscapped at 500 events for the live SSE/timeline view; everything else queried lazily from the store.state.eventsstill capped at 500; useMemo deps unchanged in shape (just the body queries the store).Out of scope (folded the AC where it doesn't apply)
The original ticket mentioned "the 4 MB backfill" + "47 reducer tests rewritten." The 4 MB backfill lives in adapters (per-JSONL re-tail); they still need to read JSONL because hermes/openclaw don't share the SQLite. The reducer's 500-event ring already matched the AC shape, so the 47 reducer tests stayed green without rewrite. Project-index / sessionRows passes moved to the web UI in v0.0.4 already, so that AC bullet is N/A in the TUI.
Test plan
npm run typecheck— cleannpm test— 368/368 pass (was 364; +4 new insqlite.test.tscovering listRecentEvents desc/asc, sinceTs, and limit clamp)npm run build— server (tsup) + web (vite) both build