Repository navigation
fix(infra): import legacy plugin state partially (newest-first) instead of skipping when capacity is short - #109679
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 17, 2026, 3:44 AM ET / 07:44 UTC. Summary PR surface: Source +131, Tests +247. Total +378 across 6 files. Reproducibility: no. live current-main reproduction was established in this review, but the failure is source-reproducible: a near-full shared Telegram namespace makes the all-or-nothing preflight repeatedly skip every missing legacy row. Review metrics: none identified. Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Use the bounded newest-first migration with original-age preservation and deferred remainder, then land it only after exact-head gates pass and the migration owner confirms the upgrade semantics. Do we have a high-confidence way to reproduce the issue? No live current-main reproduction was established in this review, but the failure is source-reproducible: a near-full shared Telegram namespace makes the all-or-nothing preflight repeatedly skip every missing legacy row. Is this the best way to solve the issue? Yes, this is the narrowest maintainable fix found: capacity-bounded newest-first imports make progress without blocking startup, while the migration-only timestamp path preserves existing eviction ordering. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against f69cb2f75e49. Label changesLabel justifications:
Evidence reviewedPR surface: Source +131, Tests +247. Total +378 across 6 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (3 earlier review cycles)
|
|
Addressed the P1 in What changed
Local runs (all green):
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
…r-nothing PR #108744 (13a52cf) made the startup preflight skip a legacy plugin-state import entirely whenever the target namespace (or the per-plugin cap) could not fit every missing entry, and rolled back the whole import when a mid-import cap eviction was detected. For caches whose migration targets the same namespace the live cache writes to (e.g. the Telegram sent-message cache), a busy install keeps the namespace near-full, so the migration became a permanent no-op that retried on every startup until legacy entries aged out. - Import newest-first up to the remaining capacity (namespace and per-plugin) instead of skipping everything; entries carry an optional timestamp (falling back to remaining TTL) for recency ordering. - On a mid-import cap eviction, roll back only the entry whose write triggered the eviction, restore the evicted live row when its value is still known, and keep everything imported so far. - Leave the legacy source in place while entries remain deferred so later startups import the remainder as capacity frees; archival of fully-covered or empty sources is unchanged. - Preflight now uses the effective per-plugin cap so capacity math matches store enforcement. Requested by obviyus: startup/upgrade must never be blocked and the migration must not permanently no-op. Co-Authored-By: Claude Fable 5 <[email protected]>
…y write path Imported legacy rows previously went through the normal register path, which stamps created_at with the import time. Because cap eviction removes the smallest created_at first, older migrated rows became the newest rows in the namespace, so the next live write could evict fresher pre-existing entries before the legacy ones. Route imports (and mid-import restores) through a migration-only write that keeps the legacy timestamp, and add a regression test proving the next live write evicts the migrated row instead of the fresher existing row. Co-Authored-By: Claude Fable 5 <[email protected]>
1971dfc to
59588cd
Compare
|
Rebased onto current main ( Local verification after rebase (all green)
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
@clawsweeper automerge |
1 similar comment
|
@clawsweeper automerge |
…instead of skipping when capacity is short (openclaw#109679)
…instead of skipping when capacity is short (openclaw#109679)
Share existing config-path and retired-media traversal owners. Remove speculative rollback, retry, reentry, and diagnostic freshness machinery while preserving security effect checks, ordinary cleanup settlement, resource bounds, and public config, CLI, protocol, and persisted-data shapes. Phase E is untouched. Production delta: 335 net lines removed (+97/-432) across 16 old files. Focused proof: 311 tests in 25 files; final embedding/shutdown proof: 91 tests in 4 files. Independent scoped review found no actionable P0-P2 findings. Published as a branch only under the campaign's below-500 rule, not a PR. Best-effort tradeoffs accepted - Overlapping failed env publications may require reload/restart instead of ordered compensation; #105289/#103736 document synthetic harness proof, not a human actual-use report. - Failed in-process restart preparation/emission requires explicit config reapply or manual restart; #105289/#160375 describe synthetic timing, not a transient transport failure. - A mount changed during sampling may briefly be attributed to its parent filesystem until the next snapshot; #149792 uses forced mount fixtures, without a human incident. - CLI provider cleanup is attempted once; #113471's blocked-close fixtures do not establish a transient failed-close incident, and the CLI exits on cleanup failure. - Requested-head CI details are a snapshot until refresh; #148464's synthetic push/rerun interleavings do not justify rereading the head and check inventory after fetching jobs. - A malformed catalog resolver may repeat rejection until the existing 16-fallback bound instead of an earlier identity bailout; #92175/#89456 are synthetic trust-harness work, and every trust check remains. - Model normalizers must not reenter the same resolver; #156076's callback reentry is synthetic. Measured lookup caches and ordinary callback errors/order remain. - Offline plugin-state imports assume no unsupported same-destination writer after capacity preflight; #109679's ordinary near-capacity import remains fixed, while concurrent eviction compensation came from synthetic sibling seeding. - A delayed update verification reply may repeat a terminal broadcast or briefly show old status; #160592 supplies synthetic ordering proof, while durable effect idempotency, FIFO, repair authority, and shutdown joining remain. - A malformed reply from the fixed inline CA worker may fail instead of using a dedicated invalid-result fallback; #112338/#112336 do not report a human malformed-message incident. Timeout/error/exit handling remains. - Failed Gateway embedding cleanup blocks only its agent/provider scope until restart instead of retaining provider objects and retrying close; #113471 documents synthetic blocked-close proof, not a human failed-close incident. Local FIFO cleanup, remote concurrency, abort handling, authority, and normal shutdown settlement remain.
…#170826) * refactor: simplify older agent and channel execution paths Consolidate duplicate payload and metadata projections under their existing owners. Simplify internal bookkeeping and bounded cache invalidation while retaining public SDK contracts, security-effect authority, ordinary concurrency, and durable user state. * refactor: retain branch cache pending complete old-code cutover Withdraw the branch-cache cluster because completing its unused-export cleanup requires an infra owner touched this week. Preserve the original cache, regression assertions, and docs. The remaining old-code lane removes 424 net production lines and is branch-only under the campaign BELOW-500 rule. * refactor: simplify old gateway, config, and CLI bookkeeping Share existing config-path and retired-media traversal owners. Remove speculative rollback, retry, reentry, and diagnostic freshness machinery while preserving security effect checks, ordinary cleanup settlement, resource bounds, and public config, CLI, protocol, and persisted-data shapes. Phase E is untouched. Production delta: 335 net lines removed (+97/-432) across 16 old files. Focused proof: 311 tests in 25 files; final embedding/shutdown proof: 91 tests in 4 files. Independent scoped review found no actionable P0-P2 findings. Published as a branch only under the campaign's below-500 rule, not a PR. Best-effort tradeoffs accepted - Overlapping failed env publications may require reload/restart instead of ordered compensation; #105289/#103736 document synthetic harness proof, not a human actual-use report. - Failed in-process restart preparation/emission requires explicit config reapply or manual restart; #105289/#160375 describe synthetic timing, not a transient transport failure. - A mount changed during sampling may briefly be attributed to its parent filesystem until the next snapshot; #149792 uses forced mount fixtures, without a human incident. - CLI provider cleanup is attempted once; #113471's blocked-close fixtures do not establish a transient failed-close incident, and the CLI exits on cleanup failure. - Requested-head CI details are a snapshot until refresh; #148464's synthetic push/rerun interleavings do not justify rereading the head and check inventory after fetching jobs. - A malformed catalog resolver may repeat rejection until the existing 16-fallback bound instead of an earlier identity bailout; #92175/#89456 are synthetic trust-harness work, and every trust check remains. - Model normalizers must not reenter the same resolver; #156076's callback reentry is synthetic. Measured lookup caches and ordinary callback errors/order remain. - Offline plugin-state imports assume no unsupported same-destination writer after capacity preflight; #109679's ordinary near-capacity import remains fixed, while concurrent eviction compensation came from synthetic sibling seeding. - A delayed update verification reply may repeat a terminal broadcast or briefly show old status; #160592 supplies synthetic ordering proof, while durable effect idempotency, FIFO, repair authority, and shutdown joining remain. - A malformed reply from the fixed inline CA worker may fail instead of using a dedicated invalid-result fallback; #112338/#112336 do not report a human malformed-message incident. Timeout/error/exit handling remains. - Failed Gateway embedding cleanup blocks only its agent/provider scope until restart instead of retaining provider objects and retrying close; #113471 documents synthetic blocked-close proof, not a human failed-close incident. Local FIFO cleanup, remote concurrency, abort handling, authority, and normal shutdown settlement remain. * refactor: defer pricing cache cleanup touched on main Withdraw the usage-format production and paired test changes after main landed afc559c, keeping the hard seven-day old-code exclusion. Both files match the pre-campaign base, so main retains its interrupted-stream usage repair. The remaining reviewed o05/o06 union removes 713 net production lines across 42 files.
…openclaw#170826) * refactor: simplify older agent and channel execution paths Consolidate duplicate payload and metadata projections under their existing owners. Simplify internal bookkeeping and bounded cache invalidation while retaining public SDK contracts, security-effect authority, ordinary concurrency, and durable user state. * refactor: retain branch cache pending complete old-code cutover Withdraw the branch-cache cluster because completing its unused-export cleanup requires an infra owner touched this week. Preserve the original cache, regression assertions, and docs. The remaining old-code lane removes 424 net production lines and is branch-only under the campaign BELOW-500 rule. * refactor: simplify old gateway, config, and CLI bookkeeping Share existing config-path and retired-media traversal owners. Remove speculative rollback, retry, reentry, and diagnostic freshness machinery while preserving security effect checks, ordinary cleanup settlement, resource bounds, and public config, CLI, protocol, and persisted-data shapes. Phase E is untouched. Production delta: 335 net lines removed (+97/-432) across 16 old files. Focused proof: 311 tests in 25 files; final embedding/shutdown proof: 91 tests in 4 files. Independent scoped review found no actionable P0-P2 findings. Published as a branch only under the campaign's below-500 rule, not a PR. Best-effort tradeoffs accepted - Overlapping failed env publications may require reload/restart instead of ordered compensation; openclaw#105289/openclaw#103736 document synthetic harness proof, not a human actual-use report. - Failed in-process restart preparation/emission requires explicit config reapply or manual restart; openclaw#105289/openclaw#160375 describe synthetic timing, not a transient transport failure. - A mount changed during sampling may briefly be attributed to its parent filesystem until the next snapshot; openclaw#149792 uses forced mount fixtures, without a human incident. - CLI provider cleanup is attempted once; openclaw#113471's blocked-close fixtures do not establish a transient failed-close incident, and the CLI exits on cleanup failure. - Requested-head CI details are a snapshot until refresh; openclaw#148464's synthetic push/rerun interleavings do not justify rereading the head and check inventory after fetching jobs. - A malformed catalog resolver may repeat rejection until the existing 16-fallback bound instead of an earlier identity bailout; openclaw#92175/openclaw#89456 are synthetic trust-harness work, and every trust check remains. - Model normalizers must not reenter the same resolver; openclaw#156076's callback reentry is synthetic. Measured lookup caches and ordinary callback errors/order remain. - Offline plugin-state imports assume no unsupported same-destination writer after capacity preflight; openclaw#109679's ordinary near-capacity import remains fixed, while concurrent eviction compensation came from synthetic sibling seeding. - A delayed update verification reply may repeat a terminal broadcast or briefly show old status; openclaw#160592 supplies synthetic ordering proof, while durable effect idempotency, FIFO, repair authority, and shutdown joining remain. - A malformed reply from the fixed inline CA worker may fail instead of using a dedicated invalid-result fallback; openclaw#112338/openclaw#112336 do not report a human malformed-message incident. Timeout/error/exit handling remains. - Failed Gateway embedding cleanup blocks only its agent/provider scope until restart instead of retaining provider objects and retrying close; openclaw#113471 documents synthetic blocked-close proof, not a human failed-close incident. Local FIFO cleanup, remote concurrency, abort handling, authority, and normal shutdown settlement remain. * refactor: defer pricing cache cleanup touched on main Withdraw the usage-format production and paired test changes after main landed 7a00a9f, keeping the hard seven-day old-code exclusion. Both files match the pre-campaign base, so main retains its interrupted-stream usage repair. The remaining reviewed o05/o06 union removes 713 net production lines across 42 files.
Fixes a regression from #108744 (
13a52cf0a53): the startup preflight made legacy plugin-state imports all-or-nothing, so whenever the target namespace (or the 50k per-plugin cap) couldn't fit every missing legacy entry, the whole import was skipped. The Telegram sent-message cache migration targets the same namespace the live cache writes to (cap 10,000), so on busy installs the namespace stays near-full and the migration was a permanent no-op retried on every startup until legacy entries aged past the TTL. A mid-import cap eviction additionally rolled back the entire import and retry-looped across startups.Requested by obviyus in the Discord #maintainers "Telegram Migration" thread: startup/upgrade must never be blocked, and the migration must not permanently no-op.
What changed
min(namespace remaining, per-plugin remaining)and imports the newest entries that fit instead of skipping everything. Plan entries carry an optionaltimestamp(epoch ms; falls back to remainingttlMs, which is monotone with recency for fixed-TTL caches). The Telegram sent-message lister now provides it.cleanupWhenEmptybehavior for fully-expired files are unchanged, as is the intentional TTL-boundary drop.resolveMaxPluginStateEntriesPerPlugin) so its math matches actual store enforcement.Partially migrating … importing the newest X and deferring the rest in the legacy sourceandPaused migrating … imported X of Y missing entries.Tests
New/updated unit tests in
doctor-state-migrations.test.ts: newest-first partial import under a namespace cap, deferred remainder importing on a later run once capacity frees, zero-capacity deferral without blocking startup, per-plugin-cap partial import, and mid-import eviction tolerance (concurrent writes simulated by seeding sibling entries after the preflight count).Evidence / verification
13a52cf0a53; skip site wassrc/infra/state-migrations.plugin-state.ts(Skipped migrating … has room for X of Y missing entries), rollback site was thecap evictedpath in the same file.TELEGRAM_SENT_MESSAGE_CACHE_MAX_ENTRIES = 10_000, live cache and migration sharetelegram.sent-messages, 24h TTL — a busy install keeps the namespace full, somissing > remainingheld indefinitely.pnpm vitest run src/commands/doctor-state-migrations.test.ts→ 89 passedpnpm vitest run src/plugin-state/→ 64 passedpnpm vitest run --config test/vitest/vitest.extension-telegram.config.ts extensions/telegram/src/state-migrations.test.ts extensions/telegram/src/send.test.ts→ 182 passedpnpm tsgo:allclean;oxlint/oxfmt --checkclean on changed files🤖 Generated with Claude Code