docs(#4908): correct cache-invalidation comment per Opus gate — TTL is the backstop for externally-driven changes
Opus SHIP-WITH-FIXES (no code change required): the comment/docstring overstated that the session-list-change listener covers ALL structural mutations. In-app mutations fire it, but externally-driven changes (scheduled cron completion, external CLI writes) don't — for those the 30s streaming TTL is the load-bearing backstop (≤30s bounded, self-healing lag). Comment-only accuracy fix; logic unchanged (both gates: perf fix correct, freeze effective, staleness bounded).
This commit is contained in:
parent
b87a605306
commit
7791370d49
2 changed files with 15 additions and 7 deletions
|
|
@ -4256,8 +4256,11 @@ def _cli_sessions_streaming_freeze_marker():
|
|||
a stream starts/stops (so the just-finished turn's rows are picked up promptly).
|
||||
A streaming session's own CLI/cron title/count is not what this projection
|
||||
returns (the streaming session is overlaid live by the route layer), and any
|
||||
structural mutation invalidates the cache directly via
|
||||
``clear_cli_sessions_cache``, so nothing user-visible lags under the freeze. (#4842)
|
||||
in-app structural mutation invalidates the cache directly via
|
||||
``clear_cli_sessions_cache``. Externally-driven changes that don't fire that
|
||||
listener (a scheduled cron completing, an external CLI writing rows) surface
|
||||
within one streaming-TTL window (≤30s) rather than instantly — a bounded,
|
||||
self-healing lag that is the deliberate latency/CPU trade-off of the freeze. (#4842)
|
||||
"""
|
||||
try:
|
||||
active = _active_stream_ids()
|
||||
|
|
|
|||
|
|
@ -208,11 +208,16 @@ def _on_session_list_changed(profile: str | None = None) -> None:
|
|||
# #4842: also drop the inner CLI/cron projection cache. While a turn streams
|
||||
# that cache is frozen on a stable streaming marker (so per-token message
|
||||
# writes don't bust it), which means it no longer self-invalidates via the
|
||||
# state.db content fingerprint mid-stream. Structural mutations (cron
|
||||
# completion, new/renamed/archived sessions, attention) DO fire this
|
||||
# listener — and never fire per streamed token — so clearing here restores
|
||||
# prompt freshness for real changes without reintroducing the per-poll
|
||||
# rebuild the freeze removed.
|
||||
# state.db content fingerprint mid-stream. In-app structural mutations
|
||||
# (session create/rename/archive/delete/branch/pin/move/import, attention)
|
||||
# fire this listener — and never fire per streamed token — so clearing here
|
||||
# restores prompt freshness for those without reintroducing the per-poll
|
||||
# rebuild the freeze removed. Note: externally-driven changes that do NOT go
|
||||
# through this listener (a scheduled cron job completing, or an external CLI
|
||||
# writing rows directly) are not cleared here mid-stream; for those the 30s
|
||||
# streaming TTL is the backstop — they surface within one streaming-TTL
|
||||
# window (≤30s) rather than instantly. That bound is the deliberate
|
||||
# latency/CPU trade-off of the freeze.
|
||||
try:
|
||||
from api.models import clear_cli_sessions_cache
|
||||
clear_cli_sessions_cache()
|
||||
|
|
|
|||
Loading…
Reference in a new issue