You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Evaluate and port the behaviour from Kpa-clawbot/CoreScope#2059: coalesce concurrent cache misses for GetChannels and GetEncryptedChannels so one cold/expired key causes one SQLite query rather than one query per request.
Why this is still relevant here
Current fork master still has no channel-query singleflight. GetChannels uses a 60-second cache, but concurrent callers can all miss before the first result is stored. GetEncryptedChannels follows a separate query path.
The upstream message-page cache is unsafe to copy directly here: it returns shared mutable maps, while fork handlers mutate them through annotateMessageAreas and annotateBotReplyTouchedAreas.
Recommended extension to this issue: use keyed caches plus per-key singleflight for normalized-region channel and encrypted-channel queries. Benchmark message-page caching as a separate decision, and require an immutable/copy-on-read contract before adding it.
Draft PR #138 klar til review: CI grøn (Go Build & Test, Playwright E2E, Docker build). GetChannels og GetEncryptedChannels bruger nu en begrænset cache pr. normaliseret region med singleflight og et ekstra cache-tjek inde i flighten. #107 og #98 er bevaret. Der er ingen message-page-cache og intet nyt indeks. 16 samtidige kolde kald giver 2 queries (master: 16).
Fixed by #138 (merged as e829d1ea). The list cache is per normalized region, concurrent misses share one query, rows.Err() is checked, and keys over 256 bytes are stored as a digest while the query still gets the full region. Review note, not blocking: TTL expiry itself has no dedicated test.
Activity
dborup commentedon Sep 28, 2026
Additional scope found in upstream Kpa-clawbot#1936
The selective cache work in Kpa-clawbot/CoreScope#1936 reinforces this issue but should not be ported wholesale.
Current fork findings:
GetChannelsstill has a single-slot cache rather than a cache keyed by normalized region.GetEncryptedChannelshas no equivalent cache.annotateMessageAreasandannotateBotReplyTouchedAreas.Recommended extension to this issue: use keyed caches plus per-key singleflight for normalized-region channel and encrypted-channel queries. Benchmark message-page caching as a separate decision, and require an immutable/copy-on-read contract before adding it.
dborup commentedon Sep 29, 2026
Draft PR #138 klar til review: CI grøn (Go Build & Test, Playwright E2E, Docker build).
GetChannelsogGetEncryptedChannelsbruger nu en begrænset cache pr. normaliseret region med singleflight og et ekstra cache-tjek inde i flighten. #107 og #98 er bevaret. Der er ingen message-page-cache og intet nyt indeks. 16 samtidige kolde kald giver 2 queries (master: 16).Generated by Claude Code
fix(channels): fail a channel list query whose rows stop on an error (#…
fix(channels): bound the byte size of channel list cache keys (#109)
test(channels): pin that a long region key is queried unhashed (#109)
dborup commentedon Sep 30, 2026
Fixed by #138 (merged as
e829d1ea). The list cache is per normalized region, concurrent misses share one query,rows.Err()is checked, and keys over 256 bytes are stored as a digest while the query still gets the full region. Review note, not blocking: TTL expiry itself has no dedicated test.