Repository navigation
Conversation
The client data cache kept every session's transcript and pending rows after its tab closed, and late reads, older pages and later events could bring evicted rows back. createSessionRetention, wired in createServerController, evicts a session family once no open tab, session route, running work or attention request has kept it for one second with no navigation pending. Rows that return after eviction are released at the next deadline. Eviction keeps unacknowledged submissions and sessions still being created, so the policy retries until they settle. Adds data.session.cached, which lists sessions holding transcript or pending rows and notifies only when that set changes. Refs #77
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Superseded by PR #96, squashed into Closing this earlier PR as superseded, not claiming it was independently merged. Its branch remains intact. Final combined verification is deferred until the scoped implementation issues are closed, as requested by the user. |
Summary
Releases cached session transcripts after their tabs close (#77).
The client data cache kept every session's transcript and pending rows after its tab closed. Late reads, older pages and later events could also bring evicted rows back.
createSessionRetention(packages/app/src/runtime/server/session-retention.ts) is wired increateServerController. It evicts a session family once nothing has kept it for 1 s while no navigation is pending.sessionId,routeSessionId,routeParentId)data.session.active())message.sync,loadMoreand events. A family that keeps receiving rows still releases at its first deadline.data.session.cached(packages/client/src/solid/data.ts) lists sessions holding transcript or pending rows. It notifies only when that set changes, not for each streamed row.Tests
packages/app/test-browser/session-retention.test.ts: 8 pass.createData, run withbun test --conditions=browser --isolate --preload ./happydom.ts ./test-browser/session-retention.test.ts.WeakRefwas collected.test-browser/files, this file is outsidepackages/app/tsconfig.json, so the typecheck does not cover it.packages/app/e2e/regression/tabs.spec.ts: 20 passed in dev mode.Ctrl+Shift+T. It checks that B's transcript is read again and that the open tab A is read only once.runtime.tsxreverted to the base, the new test fails: B is read once instead of twice. So it depends on the app actually evicting B.packages/clienttest/solid-eviction.test.ts: 4 pass.packages/tuitest/context/session-retention.test.ts: 6 pass.bun typecheckpasses inpackages/clientandpackages/app.bun run check: passes. Lint has 0 errors (2186 existing warnings),sdk-docsreports 0 problems, and typecheck is 37/37.@opencode/core'stsgois OOM-killed unless Go's GC is tuned.GOGC=25 GOMEMLIMIT=3GiB TURBO_ENV_MODE=loose bun run check, with scripts, hooks and coverage unchanged.Performance
The result is mixed. This is not a no-regression claim.
Full timeline benchmark, baseline vs. after:
dafdcd41and this branch, build mode,--repeat-each=10, n=10 per metric, in ms.Matched rerun of the two largest firstCorrect rises:
runtime.tsxanddata.ts, and the treatment run used this branch. They ran back to back with the same command, in that fixed order.Reading the results:
cachednotifies only when the set of cached sessions changes.Follow-up
Refs #77