Skip to content

startup migrations: gate refuses ready on a legacy plugin-state sidecar whose rows are all already in shared state; error names a non-sidecar key #109832

Description

@jonasserry

Summary

Upgrading 2026.6.11 → 2026.7.1: 6.11 had long since imported our legacy plugin-state sidecar (plugin-state/state.sqlite) into shared state, but never retired the file (no .migrated rename, unlike the telegram-dir sidecars). 7.1's migration gate sees "sidecar present AND target namespace non-empty", declares the migration unclean, and refuses to report ready. There is no clean upgrade path from that state, and every retry re-trips the gate.

The sidecar was 100% redundant

The sidecar held 71 rows (67 telegram.message-cache, 3 telegram.topic-name-cache, 1 telegram.bot-info-cache; file last written weeks before the upgrade). Comparing against shared state (plugin_state_entries):

  • 67 rows byte-identical in shared state
  • 4 rows where shared state was newer
  • 0 rows unique to the sidecar

Nothing held the file open. This is "import finished long ago, source never retired", not a real conflict.

The error message points at the wrong thing

The boot error cited a key of the form …:<chat-id>:162 as "already existed in shared state". That key is not in the sidecar at all; it was written to shared state moments earlier by the live 6.11 gateway (message-cache rows are written continuously per message). So the guard is tripping on "target namespace non-empty", and the message sent us diagnosing a data conflict that does not exist.

Why the operator cannot get out cleanly

Expected

When every sidecar row is already present in shared state, identical or older, treat the migration as satisfied: retire the sidecar (rename .migrated, matching the telegram-dir convention) and boot. If real conflicts exist, name the actual conflicting sidecar rows, not a key from the live namespace.

Metadata

Metadata

Assignees

Labels

P0Emergency: data loss, security bypass, crash loop, or unusable core runtime.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.impact:ux-release-blockerA non-technical user is blocked without terminal, logs, config, or support.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

Type

No type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions