Skip to content

perf: count observations before loading session-cap candidates - #491

Merged
possiblyneal merged 1 commit into
mainfrom
perf/479-session-cap-count
Nov 21, 2026
Merged

possiblyneal merged 1 commit into
mainfrom
perf/479-session-cap-count

Conversation

@possiblyneal

Copy link
Copy Markdown
Owner

Intent

Closes #479

Avoid loading every Observation on each capture when the Session is still within its cap. Keep existing victim selection when it exceeds the cap.

Read first

  • src/functions/observe.ts:91 — count before loading eviction candidates.
  • docs/benchmarks/2026-11-21-session-cap-count.md — measurement and limits.

Decisions

  • Use a SQLite count through the Engine; do not maintain a second counter.

Out of scope

  • Changing victim selection or at-cap latency.

Verified

  • npm run build → passed; no tracked generated changes.
  • npm run typecheck && npm test → 3,190 passed, one skipped.

Not verified

  • At-cap latency and live deployment. The recent scorecard measured a combined candidate, not this patch in isolation.

Merge danger

Door: A revert restores the previous row loading behavior.

Blast radius: Observation capture and Session-cap eviction.

Generated-By: claude-sonnet-5-5
@possiblyneal

Copy link
Copy Markdown
Owner Author

Code review: standard scan, clean.

Axes: Standards+Spec, Correctness/Logic

Reviewed-Head: 60d7b66

@possiblyneal
possiblyneal merged commit bb0b270 into main Nov 21, 2026
3 checks passed
@possiblyneal
possiblyneal deleted the perf/479-session-cap-count branch November 21, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session-cap eviction lists the whole Session on every Observation

1 participant