Repository navigation
Stop using a cached projection watermark as a usage cursor - #295
Merged
Merged
Conversation
A Session-list row's projections are hints, not cursors. Only a 'sequenced' block shares the Session log's sequence space; a 'cached' block carries the persisted cache's own watermark. Using that watermark as throughSeq either dropped later calls or failed the whole Session with 'past cursor', so its usage vanished from the totals. Read the Session's exact cursor unless the hint is sequenced. Tests cover a cached watermark ahead of the log, one behind it, a hint without a sequence space, and the sequenced fast path.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Issue
Refs #35. This fixes a Usage read error reported there. It does not claim to fix the "Bot @" no-response symptom, so the issue stays open.
What changed / 改了什么
Usage scans each Session log up to a cursor taken from the Session-list row. Those
projectionsare hints: onlykind: 'sequenced'shares the Session log's sequence space, whilekind: 'cached'carries the persisted projection cache's own watermark. The scan used either asthroughSeq, so a cached watermark ahead of the log madepage()fail with "past cursor" and dropped that whole Session from the totals, and one behind the log left later calls uncounted.Only a sequenced hint now cuts the page. Every other row (cached, or a hint from an older DSH without
kind) reads the Session's exact cursor, asscanSessionalready does when no hint is usable. The change is one helper plus four regression tests; no API or client change.Changelog
Usage totals no longer miss calls when a Session list serves a cached projection watermark.
How I checked it / 怎么验证的
npm test(inds-bot/): 652 of 652node scripts/build-client.mjs --checknpm run lint: 0 errors, 13 warningsChecklist / 检查
src/client/change, soclient.jsis untouched. / 改了src/client/就已重新 build 并提交client.js。Co-authored-by. / 没有把 AI 工具写成作者或Co-authored-by。The diagnosis and an earlier patch came from @EventHorizonXT in #35. This version is rebased on
dev(d2f21d2) and keeps the same one-line fix with regression tests.