Skip to content

fix(control-ui): retire deleted sessions once without wiping cached sidebars - #189729

Merged
steipete merged 7 commits into
mainfrom
steipete/coldload-deletion-invalidation-storm
Nov 1, 2026
Merged

steipete merged 7 commits into
mainfrom
steipete/coldload-deletion-invalidation-storm

Conversation

@steipete

@steipete steipete commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Repeated publications of an already-confirmed session deletion caused each mounted chat pane to invalidate the same snapshot again. In a real isolated Gateway with two browser tabs and 20 unrelated roster publications, the tabs broadcast 25 / 5 invalidations for one deleted session. Each event also retired the entire cached sidebar, including unrelated conversations.

The repair produces 1 / 1 broadcasts, preserves the sidebar through two virtual minutes of churn with zero wipes, removes the deleted row from cached reloads, and writes the sidebar only when its display model changes.

Why This Change Was Made

The shell already retires each confirmed deletion. Remove the competing pane replay instead of adding another deletion-deduplication owner. A single canonical pruning helper removes the deleted session and its nested rows, navigation references, and boot-roster entry. Display, in-flight prewarm, IndexedDB, and the already-published boot roster consume that operation within their existing lifetimes; account/scope retirement still clears the whole projection.

History: #125128 made the pane's replayed cache deletions observable by the persistent snapshot owner. #168206 extended one session's invalidation to the entire sidebar projection. This is amplification of those existing paths, not an identified post-r241 introducer.

Two associated owner fixes remain: malformed individual conversation/board/history records evict only that record instead of resetting the entire database; identical sidebar models skip duplicate cross-tab writes, and roster receipt ts does not count as a display change. These are plausible contributors to the live three-record chat cache and write churn, not proof of their exact live causes. Real two-tab probes observed zero whole-database resets; aggregate corruption, I/O recovery, account retirement and projection-version eviction remain separate paths.

User Impact

Deleting one conversation removes it without emptying the rest of the cached sidebar. Unrelated conversations remain available on reconnect and reload, and a deleted conversation does not return from the cache. Unchanged roster publications and cached-to-live handoff do not keep rewriting the sidebar.

This PR does not fix the chat route's first-frame blank/skeleton or claim seamless complete first paint. That separate admission/paint-holding work belongs to the other reload lanes. No new configuration, Gateway protocol, server schema, or retention policy.

Evidence

All browser fixtures and media are synthetic; no private capture content is included.

Contract Before Repair
Real Gateway, two tabs, deletion plus 20 unrelated state publications 25 / 5 sends, one unique deleted key 1 / 1 sends
Native two-tab normal deletion, two virtual minutes of churn Broad sidebar invalidation reproduced at the owner boundary One send + one receive per tab; zero wipes; one shared write; survivor restored with connect held; deleted row absent
Native subagent deletion, same churn Duplicate peer writes in intermediate repair Same event/wipe/reload contract; two writes for two distinct models: row prune, then retained-parent child-load targets
Independent writers, two meaningful models Four puts Two puts; expired identical model still refreshes
Malformed individual conversation/board/history record Unrelated valid chat lost in each of three regression cases Unrelated chat retained

The native write bound is 1 write / 2 virtual minutes for normal deletion and 2 / 2 for a subagent (0.5/min and 1/min), with no further writes during churn. The observed live baseline was 71 writes / 183 seconds (23.3/min). These are different workloads, so this is a deterministic work-count bound, not a paired wall-clock speed claim.

Validation

Final head: 080142de4798fb81e869ab509110c8d8bd1420d1 (rebased base 1440bb1771372334bea23d7642bb52deb7db1845). Independent Codex review is clean through P2; range-diff preserved all seven patches. Exact-head CI is green.

AWS lease cbx_27e1468e115e, fixed c7a.4xlarge (16 vCPU / approximately 31 GiB), final-head validation run:

Check Result
Focused owner tests 6 files / 130 tests passed; 13 s
Controller guard Passed; 5 s
Base/candidate bundle budget Passed; 63 s
Canonical UI build Passed; 28 s
Native two-tab regression Both normal and subagent cases passed; 38 s; writes [1,0] / [2,0]
node scripts/check-changed.mjs 829 s; all checks passed except the full-tree unused-export scan described below
Full UI e2e Completed on final head: 878 files passed, 6 failed, 3 skipped; 3,337 tests passed, 2 failed, 17 skipped; 4,941 s command wall

Four of those six file failures were setup errors: my initial payload installed Chromium but omitted WebKit. After installing WebKit, all four files passed individually on the same final head: logs-scroll (3 tests), tooltip-first-activation (2), chat-composer-picker-layout (4), and workboard-native-bundle (4). This resolves 13 of the 17 skipped cases; the remaining four cases retain their existing opt-in proof, live-provider, or desktop-fixture requirements. This is a full run plus focused setup repairs, not a claim that the original full invocation was green.

Follow-up proof and main controls, same AWS lease: both actual failing cases reproduce on freshly fetched main 17e2d54e2fbea1161bb8da5a3bbb6a9a35214d3a with the same errors:

File / failing case Candidate and main control
chat-outbox-migration.e2e.test.ts: preserves qualified/global v3 Blobs through migration, reload and retries Initial-roster readiness timeout on the standalone legacy seed page
extensions/qa-lab/src/control-ui-automation-management.real-gateway.e2e.test.ts: configured owners/admin manage a Telegram-created job Crabline fixture setup rejects a private mutation boundary writable by another POSIX principal

The full-tree unused-export scan reports DATABASE_SNAPSHOT_FREE_SPACE_RESERVE_BYTES and MAX_DATABASE_SNAPSHOT_EXTRACT_BYTES from untouched src/commands/backup-verify-spool.ts. Current main's scan passes. The same two findings reproduce on recorded base 1440bb1771372334bea23d7642bb52deb7db1845 (base control); they are inherited from the base and fixed since on current main. No scan bypass was used.

The final startup comparison is 89,492 B gzip versus base 89,313 B (+179 B), three requests in both arms, with the 89,930 B enforcement limit unchanged. Earlier CI found two attributable import-boundary failures: static schema imports added 3,553 B, then stored dynamic module imports exceeded the manual-import ratchet. Both are repaired: utility reads are destructured, schema loading happens on deletion before opening the IndexedDB transaction, and prewarm retains only its derived snapshot promise. No budget waiver, loader helper, new owner, or baseline allowance.

Earlier real-Gateway proof: AWS cbx_0c8b568d76c3, baseline, repair.

Changed-test command costs (pnpm test <file> --maxWorkers=1, one file per command): sidebar-snapshot.test.ts 4.42 s; chat-pane-session-presentation.test.ts 5.85 s; session-snapshot-store.test.ts 2.83 s; sidebar-snapshot-store.test.ts 2.82 s. The final-head remote focused command covers these four plus the existing prewarm and invalidation suites: 6 files / 130 tests, 13 s. The native two-case command takes 38 s on the final-head AWS box. These are validation costs, not performance comparisons.

Bounded simplification and LOC

The bounded compression pass retained the original +173 runtime lines. Required CI repairs to the import boundary bring the final change to +177 runtime LOC (+179 under the requested diff-stat filter, which includes the two-line allocation file). It did not reach +130 without weakening a proven lifecycle/privacy behavior. Boot already re-reads the pruned prewarm model; IndexedDB, display, and prewarm already use the same pruning helper. Adding a coordinator merely to combine their lifetime adapters would create another owner.

Runtime file Net LOC Required responsibility
sidebar-snapshot-data.ts +62 One canonical prune across pins, pages, nested children, section counts, personal entries and boot roster; unchanged input preserves identity
sidebar-snapshot.ts +24 Prune displayed cache and accepted capture, fence pending stale work, preserve unchanged handoff serialization
session-snapshot-database.ts +42 Prune the persisted model in the existing transaction; preserve key-only prefix clearing so account retirement does not load transcript bodies
session-boot-snapshot.ts +18 Refresh the already-published cached roster from the pruned prewarm copy, without clearing unrelated rows
session-snapshot-prewarm.ts +9 Chain pruning onto in-flight reads so stale prewarm cannot restore the deleted row
session-snapshot-invalidation-events.ts +9 Distinguish session pruning from full sidebar/scope retirement
session-sidebar-snapshot.ts +11 Suppress identical peer writes atomically; preserve expiry refresh
session-snapshot-store.ts +5 Evict malformed records locally and cancel stale sidebar operations
sidebar-snapshot-capture.ts +4 Ignore receipt-only timestamps and omit confirmed-deleted navigation entries
chat-pane-session-observation.ts -7 Delete the competing retirement loop

Test audit consolidated the parameterized native regression from 274 to 240 lines by sharing native IDB instrumentation, row lookup and probe readout. Both session shapes and all storage-event, churn, privacy, write and reload assertions remain. Reaching 180 would trade away the real native instrumentation or compress the required auth/roster/bootstrap fixture into less readable code. No new production test seam or exported helper. Exact test-line allocation: 358, reduced from 392; no slack. Five test files plus the offline/reconnect documentation accompany the ten runtime files.

Synthetic before/after reload

Repaired live sidebar immediately before warm reload, then cached sidebar after reload with connect held. These prove survivor retention and deleted-row absence; they do not claim first-paint completeness.

Synthetic live sidebar after deletion, before warm reload

Same sidebar restored from cache with connect held after warm reload

@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 31, 2026
@clawsweeper

clawsweeper Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds regression coverage for repeated deletion broadcasts, sidebar preservation, and record-local corruption recovery.

Example: Delete agent:main:cedar while agent:main:retained remains cached.

  • Before: The account’s saved sidebar is discarded.
  • After: The new regression expects the sidebar to survive with cedar removed; production behavior remains unchanged.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful source-backed regression experiment with no discrete introduced defect; intentionally incomplete and unsuitable for merging as submitted.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-directed, test-only experiment changes no shipped behavior and explicitly leaves native two-tab and timing verification pending.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Partial
User problem: Unrelated session deletion can discard the cached sidebar, and one malformed transcript can erase other valid cached conversations.
Reason: The maintainer-directed experiment captures concrete failures in existing owners and explicitly defers implementation.

Merge readiness

✅ Ready for maintainer review

Keep this PR open as an explicitly paused regression experiment: current source supports its reported failures, but it intentionally includes no production repair.

Priority: P2
Reviewed head: 87605d2520949156c61aa18f6c1675cf307ceac1

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The experiment reports failing baseline tests; a green repair and native two-tab reload verification are not yet supplied.
Agent review details

How this fits together

The Control UI consumes Gateway deletion receipts, retires browser snapshot state, and restores cached sidebar and conversation displays on reload.

flowchart TD
  A[Gateway session publications] --> B[Shell retirement owner]
  A --> C[Chat pane observation]
  B --> D[Snapshot invalidation]
  C --> D
  D --> E[IndexedDB snapshots]
  E --> F[Cached reload presentation]
Loading

Technical review

Best possible solution:

When the owner resumes work, repair the existing retirement and snapshot owners to remove deleted display copies once while retaining unrelated valid caches.

Do we have a high-confidence way to reproduce the issue?

The added regressions reach the production pane and snapshot owners, whose source explains the reported outcomes; baseline failures are author-reported and were not independently executed.

Is this the best way to solve the issue?

The tests isolate distinct failures using existing fixtures and owners, but this experiment is a diagnosis rather than a completed solution.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4ade7ee96f86.

Provenance checked

  • Malformed-record recovery expectations changes intended behavior with a stated reason (2e7668b: The supplied provenance identifies consolidation of the retained corruption tests; their prior expectation matched whole-database recovery. The PR explicitly proposes retaining unrelated transcripts for record-local corruption while preserving metadata-wide reset behavior.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Tests +66. Total +66 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 89 23 +66
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 89 23 +66

Labels

Label changes:

  • add P2: The experiment targets unnecessary browser-cache invalidation and reload instability with a limited Control UI blast radius.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The experiment targets unnecessary browser-cache invalidation and reload instability with a limited Control UI blast radius.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 31, 2026, 4:13 PM ET / 20:13 UTC.

@steipete
steipete force-pushed the steipete/coldload-deletion-invalidation-storm branch from 87605d2 to 9745d68 Compare October 31, 2026 20:58
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: L and removed size: S labels Oct 31, 2026
@steipete
steipete force-pushed the steipete/coldload-deletion-invalidation-storm branch from 9745d68 to e4deb6e Compare October 31, 2026 21:43
@steipete
steipete force-pushed the steipete/coldload-deletion-invalidation-storm branch from e4deb6e to 342e132 Compare October 31, 2026 22:05
@steipete steipete changed the title experiment(control-ui): deletion invalidation storm [do not merge] fix(control-ui): retain sidebar snapshots on session deletion Oct 31, 2026
@steipete steipete changed the title fix(control-ui): retain sidebar snapshots on session deletion fix(control-ui): retire deleted sessions once without wiping cached sidebars Oct 31, 2026
@steipete
steipete force-pushed the steipete/coldload-deletion-invalidation-storm branch from 342e132 to 91ba31c Compare October 31, 2026 22:19
@steipete
steipete marked this pull request as ready for review October 31, 2026 22:45
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T23:18:13.447686Z 080142d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete force-pushed the steipete/coldload-deletion-invalidation-storm branch from 91ba31c to d0e9afe Compare October 31, 2026 23:00
Keep confirmed deletion retirement at the shell owner and remove the pane's replay path. Prune deleted rows across saved, prewarmed and displayed sidebars instead of retiring the account projection. Suppress unchanged handoff, roster receipt and cross-tab writes; evict malformed conversation records individually.

Regression proof covers repeated roster publications, scoped privacy pruning, independent tab writers, corruption isolation and native two-tab churn with cached reload.
Prune nested rows in one pass without the temporary filtered list, retaining immutable shared snapshot rows. Check the IndexedDB spy receiver before reading its store name and allocate the exact regression test-line delta.

Static review remains clean through P2. The lane stays blocked on the separate boot first-paint gate; no performance-gate clearance is claimed.
Resolve the remaining targeted lint findings with an explicit pending write and a distinct churn callback variable. The complete repair tree passes 130 focused tests, both typechecks, targeted lint, UI build and native two-tab deletion checks.

The campaign first-paint gate remains blocked; no landing clearance is claimed.
@steipete
steipete force-pushed the steipete/coldload-deletion-invalidation-storm branch from d0e9afe to 080142d Compare October 31, 2026 23:15
@steipete
steipete merged commit ba720f8 into main Nov 1, 2026
109 checks passed
@steipete
steipete deleted the steipete/coldload-deletion-invalidation-storm branch November 1, 2026 01:25
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 1, 2026
…idebars (openclaw#189729)

Session deletion receipts no longer replay into every chat pane or clear whole cached sidebar displays. Each deleted session is pruned once from the sidebar snapshot model (pins, pages, entries, section counts and roster), from IndexedDB records and from boot/prewarm reads; unrelated cached sidebars and transcripts stay intact. A malformed transcript record is now discarded on its own instead of resetting the whole snapshot database, and unchanged sidebar captures skip their write.

Storm proof: invalidation broadcasts 25/5 -> 1/1, zero sidebar wipes over two virtual minutes, no deleted-row resurrection, writes only for meaningful changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant