Repository navigation
Description
Parent
Follow-up from #821 (M2 — "Cursor storage seam"), deferred out of #868 / #869.
Context
#869 migrated the Redis event log from a LIST to a Stream so XREAD BLOCK can serve
cross-process follow. Review on that PR raised that the connection-capacity mitigation we
shipped is the weaker half of the fix, and the reasoning in
ADR 0250 for deferring the
stronger one ("sizing guidance is enough, and a second pool would need its own inventory
row to buy a bound the operator can already set") does not hold up:
- bounded 1s
XREAD BLOCKslices cap a watcher's hold time, not the contention. N
watchers still compete withSave/Appendfor the same pool. - raising the shared pool only moves the threshold, and
redisstoreexposes no pool
controls anyway, so "the operator can already set it" is not true today.
That makes watcher load able to starve the write path that keeps runs alive — which matters
specifically for mecak8s multi-replica, the deployment that makes cross-process follow a
requirement in the first place.
Already shipped (not part of this issue)
Recorded so this issue does not re-do them:
- bounded
XREAD BLOCKslices with actxre-check between them. - per-cycle lease acquire/release, so a follower parked for hours can no longer pin a
retired credential generation open, andStore.Closeno longer waits out its full grace
with a client held (TestCloseDoesNotWaitOnAParkedFollower). - the lease released before records are yielded, so a slow transport consumer holds no
pooled connection. - an internal
COUNTcap, soReadOptions.Limit == 0no longer means an unbounded fetch.
Scope
Change the resource boundary from "shared pool plus operator sizing" to "isolated bounded
follow capacity".
- A store-owned, bounded follow client/pool per credential generation, separate from the
client used for durability and metadata operations. Roughly one socket per actively
blocked watcher, not aredis.Clienteach. - A configurable, fail-fast per-process watcher admission limit. On exhaustion return a
resumable resource-exhausted error immediately rather than waiting out a pool timeout —
a watcher that cannot be admitted should be told so it can retry with its cursor, not
parked. - Store-lifetime cancellation of followers, so
Store.Closecan cancel in-flight
blocking reads, join with a bound, then force-close. Force-closing the isolated follow
pool is safe precisely because writes use a different client. This is the half of
the lifecycle concern that feat(redisstore,grpcdriver): migrate the Redis event log LIST -> Stream #869 did not address: the store still does not own its
followers, and a follower's own context remains the only prompt way to stop one. - Expose the follow-pool sizing/admission knobs, and document them in
docs/usage.md
plus themecak8sdeployment page. - Per AGENTS.md and ADR 0027: the follow
pool and the admission limiter are resources whose lifetime outlives one call, so each
needs a List 1 row (owner / scope / cleanup / re-attach). Neither holds session
state a restart would lose, so no List 2 row is expected — state that explicitly
rather than by omission.
Explicitly out of scope
Recorded because they will otherwise be re-litigated:
- Consumer groups are not the answer. Every watcher needs the full event stream, which
is the one thing a consumer group is designed not to give. - Pub/Sub must never carry authoritative events. It could serve as a lossy wake-up hint
followed by draining the durable Stream, but the Stream stays the source of truth. - Later-scale shapes, for whenever this is not enough: collapse multiple local watchers
behind per-session hubs, then shard sessions across multi-streamXREAD.
Verify
- A test that saturates the admission limit and asserts a resumable typed error rather
than a pool-timeout stall. - A test that concurrent watchers at the admission limit do not delay
Append/Save— the
starvation property, asserted directly rather than inferred from pool sizing. - A test that
Store.Closecancels and joins in-flight followers within its grace, with no
outstanding-operations diagnostic. - Resource-inventory rows present (the
docs/lintcitation gate covers the citations; the
per-phase re-audit covers completeness).
References
- ADR 0250 §Consequences — carries both the original deferral and the review pushback.
- Review threads on feat(redisstore,grpcdriver): migrate the Redis event log LIST -> Stream #869 (connection-pool contention, follower lifecycle).
internal/adapter/redisstore/cursoreventlog.go,internal/adapter/redisstore/generation.go.
Activity
samuv commentedon Sep 11, 2026
Removed from the completed SDK implementation parent. This remains an
independent Redis storage and follower-lifecycle improvement and does not block
the
v0.1.0SDK release in #1394.