Repository navigation
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Summary
Doctor in 2026.5.26 reports:
PluginStateStoreError: Plugin state for telegram exceeds the 1000 live row limit.
Failed migrating Telegram forum topic-name cache entry -1003734409696:1230
Root cause: telegram.message-cache namespace writes rows with expires_at = NULL,
so the expiry sweep (idx_plugin_state_expiry WHERE expires_at IS NOT NULL) never
evicts them. They accumulate until the per-plugin 1000-row cap, then any new write
(including the doctor's topic-name-cache migration) fails.
Evidence
~/.openclaw/plugin-state/state.sqlite, current live state:
| namespace | row count | rows with expires_at = NULL |
|---|---|---|
telegram.message-cache |
700 | 700 (100%) |
telegram.bot-info-cache |
1 | 0 |
telegram.topic-name-cache.<hash> |
1 | 1 |
Within hours of a manual prune this morning the cache refilled to 998/1000.
Sample row:
namespace=telegram.message-cache
entry_key=eafd015eb3f678ca29b14de8:default:-1003734409696:17179
value_json={"sourceMessage":{"message_id":17179, ...}}
created_at=1779886069586
expires_at=NULL
Environment
- openclaw
2026.5.26(10ad3aa) - node 26.0.0 (homebrew)
- macOS 25.5.0
Impact
- Doctor migrations on upgrade silently lose data (
topic-name-cacheentries
dropped when cap is hit during the rewrite). - Per-plugin 1000-row ceiling reached forever for any Telegram instance with
more than ~1000 cached inbound messages. - Manual SQLite prune is the only mitigation, and it refills within hours.
topic-name-cache.<hash>namespace appears partially populated after the
failed migration — only 1 row where the migration source had more.
Suggested fix direction
Either:
- Set a TTL on
telegram.message-cachewrites (e.g. 24h / 7d, matching how
long inbound message context is realistically useful), and let
pruneExpiredPluginStateevict them, OR - Cap
telegram.message-cachenamespace size explicitly with LRU eviction
on insert, decoupled from the global 1000-row plugin cap, OR - Raise the 1000-row cap (less ideal — same growth pattern will hit any new
ceiling).
Side note
Filed alongside #87331 (Native hook relay unavailable regression). Both
surfaced on the same upgrade; this one looks design-level rather than a
regression.
Reacted by clawsweeper
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Activity
WarrenJones commentedon May 27, 2026
clawsweeper commentedon May 27, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed May 27, 2026, 11:32 AM ET / 15:32 UTC.
Summary
Keep open. Current main still matches the reported shipped behavior: Telegram opens
telegram.message-cachewith a 1000-entry namespace budget but no TTL, persists rows without per-write TTL, and the core plugin-state store treatsexpires_at = NULLas live rows that count toward the global 1000-row plugin cap. No merged fix or canonical duplicate was found in the provided related context; the only current discussion is a contributor offering to investigate.Reproducibility: yes. Source inspection gives a high-confidence path: fill
telegram.message-cachewith NULL-expiry rows near the plugin-wide cap, add any sibling Telegram namespace row, then a message-cache write or doctor plugin-state import can hitPLUGIN_STATE_LIMIT_EXCEEDED; I did not execute it because this review is read-only.Next step
This is a narrow, source-backed Telegram/plugin-state repair candidate with clear affected files and regression-test paths, but it should be manually promoted because the failure was source-proven rather than executed in this read-only review.
Review details
Best possible solution:
Keep this open and land a focused Telegram/plugin-state fix that gives message-cache durable rows a bounded lifetime or smaller namespace budget with global-cap headroom, handles existing NULL-expiry rows, and protects doctor topic-name imports with regression coverage.
Do we have a high-confidence way to reproduce the issue?
Yes. Source inspection gives a high-confidence path: fill
telegram.message-cachewith NULL-expiry rows near the plugin-wide cap, add any sibling Telegram namespace row, then a message-cache write or doctor plugin-state import can hitPLUGIN_STATE_LIMIT_EXCEEDED; I did not execute it because this review is read-only.Is this the best way to solve the issue?
Yes, the maintainable direction is a narrow Telegram-owned fix using the existing plugin-state TTL and max-entry contracts, plus migration coverage. Raising the global 1000-row cap alone would only move the failure point.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
expires_at = NULLmessage-cache rows blocking doctor imports until a write path or doctor path prunes them.Codex review notes: model gpt-5.5, reasoning high; reviewed against 8e41c118fa80.
Label changes
Label changes:
P2: This is a normal-priority Telegram/plugin-state stability bug with real upgrade impact but a limited affected surface.impact:data-loss: The reported failure can leave Telegram cache migration entries unwritten or partially imported when plugin-state cap enforcement trips.impact:session-state: The affected rows are persisted Telegram prompt/reply context state, so failed writes can make local conversation context stale or incomplete.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:queueable-fix: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state selects this label.Label justifications:
P2: This is a normal-priority Telegram/plugin-state stability bug with real upgrade impact but a limited affected surface.impact:data-loss: The reported failure can leave Telegram cache migration entries unwritten or partially imported when plugin-state cap enforcement trips.impact:session-state: The affected rows are persisted Telegram prompt/reply context state, so failed writes can make local conversation context stale or incomplete.Evidence reviewed
Acceptance criteria:
What I checked:
resolveDefaultPersistentStore()openstelegram.message-cachewithmaxEntriesonly, andpersistCachedNode()callspersistentStore.register(...)without ttl options, so new plugin-state rows default to no expiry. (extensions/telegram/src/message-cache.ts:556, 8e41c118fa80)pluginStateRegister()computesexpiresAt = nullwhen no ttl is provided, then writes that value toexpires_at. (src/plugin-state/plugin-state-store.sqlite.ts:445, 8e41c118fa80)expires_at IS NOT NULL, while live counts include rows whereexpires_at IS NULL; those rows therefore remain live for cap enforcement. (src/plugin-state/plugin-state-store.sqlite.ts:244, 8e41c118fa80)enforcePostRegisterLimits()counts all live rows for the plugin and throwsPLUGIN_STATE_LIMIT_EXCEEDEDonce the plugin exceeds the 1000 live-row cap. (src/plugin-state/plugin-state-store.sqlite.ts:419, 8e41c118fa80)namespaceandmaxEntries, then callstore.register(...)without ttl, so imports can hit the same live-row accounting behavior. (src/infra/state-migrations.ts:159, 8e41c118fa80)TELEGRAM_MESSAGE_CACHE_PERSISTENT_MAX_MESSAGESas its max entries, matching the reported starvation path for later topic-name imports. (extensions/telegram/src/state-migrations.ts:200, 8e41c118fa80)Likely related people:
extensions/telegram/src/message-cache.ts,src/plugin-state/plugin-state-store.ts,src/plugin-state/plugin-state-store.sqlite.ts)extensions/telegram/src/message-cache.ts,src/infra/state-migrations.ts)src/infra/state-migrations.tsincludes migration performance and leaf-type work, making this a plausible routing candidate for doctor migration behavior. (role: recent migration-path contributor; confidence: medium; commits: 97ee0c6fd339, 74e7b8d47b18, 9c3d9c5c18f0; files:src/infra/state-migrations.ts)src/infra/state-migrations.ts,extensions/telegram/src/state-migrations.test.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Udjin79 commentedon May 27, 2026
I filed #87357 shortly after this one, before noticing it. They describe the same end-state from two different angles and are worth keeping side-by-side rather than dedupe'd, because the proposed fix directions don't fully overlap.
The angle in #87357: even if
telegram.message-cacherows had a sensible TTL, theenforcePostRegisterLimitseviction primitive cannot engage on the current code path. The reason is in plugin-state-store:With
TELEGRAM_MESSAGE_CACHE_PERSISTENT_MAX_MESSAGES === MAX_ENTRIES_PER_PLUGIN === 1000and any co-tenant namespace (telegram.bot-info-cachehas 1 live row by design), the path is:upsertEntryliftstelegram.message-cacheto exactly 1000.1000 > 1000→ false, no eviction.1001 > 1000→ throw, transaction rolls back.The eviction primitive never runs because the strict
>gate keeps it dormant until the per-plugin throw has already fired. Even with TTL on writes, the same trap reappears for any plugin that owns more than one namespace.So a few observations on the fix-direction options here, with respect — none are wrong, but each carries trade-offs that the structural patch in #87357 avoids:
telegram.message-cachewrites (24h / 7d) — changes the semantic of cached reply context: anything older than the TTL stops being available for inboundreply_to_messageresolution, even when the row would still be useful. Drops the cache from a bounded LRU to a time-bounded buffer. Workable, but a semantic change rather than a bug fix.sum(namespace.maxEntries) ≥ plugin.maxEntrieskeeps the bug intact for plugins with multiple namespaces.The narrower fix in #87357: change the namespace eviction gate from strict
>to>=(or reserve namespace headroom such thatΣ(namespace.maxEntries) < MAX_ENTRIES_PER_PLUGIN). That makes the existing primitive engage on the right transition without altering data lifetime semantics, and unblocks any future plugin with co-tenant namespaces, not just telegram.(Field workaround for anyone hitting this before a fix lands: prune the oldest
telegram.message-cacherows directly in SQLite to give the plugin some headroom, then patchTELEGRAM_MESSAGE_CACHE_PERSISTENT_MAX_MESSAGESdown to998in the installed bundle as a temporary measure. Reapply on every reinstall.)steipete commentedon May 27, 2026
Fixed on
mainby e339586 and backported torelease/2026.5.27by 9cc1a83.Those commits raise the plugin-wide live-row cap, keep Telegram's persistent message-cache namespace bounded, evict only within the namespace currently being written, and add regression coverage for Telegram-shaped plugin-state namespaces plus migration rollback.
Closing as fixed. Please reopen or file a fresh issue if this reproduces on a build containing 9cc1a83 or newer.