test(gateway): cover sessions.list limit-before-enrichment paths#74970
test(gateway): cover sessions.list limit-before-enrichment paths#74970anyech wants to merge 1 commit intoopenclaw:mainfrom
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: not applicable. this is a test-coverage PR rather than a user-facing bug report. The source path is clear on current main: selection runs before selected-row enrichment, and transcript reads happen inside row enrichment. Real behavior proof Next step before merge Security Review detailsBest possible solution: Merge the focused regression coverage after acceptable real behavior proof is added and exact-head checks are green, keeping runtime caching or performance slices separate. Do we have a high-confidence way to reproduce the issue? Not applicable; this is a test-coverage PR rather than a user-facing bug report. The source path is clear on current main: selection runs before selected-row enrichment, and transcript reads happen inside row enrichment. Is this the best way to solve the issue? Yes for the diff shape: focused gateway tests are the narrowest maintainable way to lock down the existing ordering without mixing in runtime changes. Merge readiness still depends on real behavior proof and green exact-head checks. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against d644798d679e. |
04483b2 to
b5433bb
Compare
Add regression coverage for sessions.list safe-path selection, transcript avoidance, and legacy search/spawnedBy boundaries. These tests guard the existing main-branch implementation that limits before row enrichment on safe list paths.
b5433bb to
0b0123b
Compare
Summary
This PR adds regression coverage for the current
sessions.listfast path that limits/window-filters safe list requests before expensive row enrichment.The tests guard the intended slice-1 behavior:
!spawnedBy && !searchcalls apply the active window andlimitbefore transcript-backed title/last-message enrichment;global/unknownrows remain excluded by default on the fast path;includeDerivedTitles/includeLastMessagetoggles do not affect row selection;search + limitremains search-before-limit on the legacy enriched path;spawnedByremains on the legacy subagent-dependent path.Context
A local copied-state investigation showed that enriching all candidate sessions before applying
activeMinutes/limitcan create large avoidable control-plane cost, including transcript reads and repeated subagent-registry reads for rows that are later dropped.Current
mainalready contains the source-side limit-before-enrichment behavior. This PR is intentionally test-only so that behavior is locked down before any follow-up slices.Validation
Ran on an isolated checkout only; no live Gateway, live config, installed dist, or live session store was modified or benchmarked.
node scripts/run-vitest.mjs run --config test/vitest/vitest.gateway.config.ts src/gateway/session-utils.test.ts src/gateway/session-utils.fs.test.ts— 133 tests passednode scripts/run-vitest.mjs run --config test/vitest/vitest.agents.config.ts src/agents/subagent-registry.persistence.test.ts— 17 tests passedcorepack pnpm lint:core— passedcorepack pnpm tsgo:core— passedcorepack pnpm build— passedgit diff --check origin/main..HEAD— passedNotes
Follow-up implementation work should stay in separate slices: