Skip to content

fix(sessions): deleted sessions remain visible during worker cleanup - #132233

Merged
steipete merged 3 commits into
mainfrom
steipete/session-deletion-bug-9fc12c
Aug 29, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/session-deletion-bug-9fc12c

Conversation

@steipete

@steipete steipete commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Closes #132057

What Problem This Solves

Fixes an issue where users deleting a session in the Control UI would keep seeing its sidebar row and open conversation while server cleanup ran. Refreshes and cached sidebar rows could bring the row back, the Sessions page ignored publications during a mutation, and active cloud-worker sessions were rejected instead of safely reclaimed.

Why This Change Was Made

Deletion now has one shared optimistic owner for single and batch operations. It removes the complete confirmed selection immediately, fences stale list/history/event results, and navigates away through the shell/pane lifecycle rather than a late caller callback. Failed operations restore only their own rows and reconcile canonical server membership without undoing unrelated edits or newer navigation. Drafts and attachments retire only after confirmed deletion; failures remain visible even after the initiating header unmounts.

On the Gateway, Archive and Delete share the existing lifecycle drain and safe worker reclaim. Deletion retains exact session, caller, and placement ownership checks through asynchronous cleanup and the synchronous commit boundary, then retires placement metadata only after deletion succeeds. This removes the archive-only implementation, duplicated client deletion flows, obsolete navigation adapters, and an outer reclaim-promise map that could deadlock against the lifecycle fence. UI, CLI, and shared iOS/macOS request builders reuse the existing ten-minute safe-reclaim deadline; explicit CLI overrides still win.

Delete notifications also carry the identity actually removed by the lifecycle result, including incognito reset. Neither leading nor delayed broadcasts sample the row currently occupying that key. Clients confirm only the identified generation; key-only lifecycle notices request canonical reconciliation rather than purging a replacement.

The maintainer explicitly approved safe reclaim as part of Delete. There is no forced abandonment, new configuration, SQLite schema change, protocol version change, or native Codex history deletion. The registered production inference-drain seam replaces a test-only duck-typed fallback. One nearby Swift test now requires valid UTF-8 instead of silently repairing malformed encoded bytes.

User Impact

Deleting one or several sessions feels immediate. The Gateway can finish slower worker reconciliation and cleanup in the background. If safe reclaim fails, the session and recovery state remain available and the UI reports the failure; a row can reappear without pulling the user away from whatever they opened next. Reconciled managed worktrees keep the existing snapshot/preservation behavior. Main-session, plugin-owner, locked-model, and archive-only permission restrictions remain intact.

Release-note context: Control UI session deletion no longer waits for cleanup or lets stale roster/history results resurrect deleted rows; attached workers stop and reconcile safely before deletion commits.

Evidence

Regression tests were first run against the original implementation and failed for immediate single/batch removal, stale prefetch, mutation-pending Sessions-page publication, list-owner rollback contamination, safe reclaim and unsynced failure, reclaim deadlock, premature placement retirement, and authority/session replacement across cleanup boundaries. The repaired owner and sibling suites pass.

Final generation/roster owner suites passed 192 tests and caller/pagination siblings passed 154 tests. After integrating the upstream refresh-queue fix, the owner/shell run passed 206 tests across 10 files. Additional proof includes 44 CLI lifecycle/transport tests, 98 archive/placement/reclaim tests, 71 Gateway plus 38 real-parser tests, and broader deletion/worktree/SQLite/Codex sibling coverage. These runs overlap and are not presented as one aggregate count. Production/test typechecks, scoped TypeScript lint/format, i18n verification, and the full changed-file core guard plan passed. Shared native request tests passed 34 tests; checksum-verified SwiftLint 0.65.0 and SwiftFormat 0.62.1 checks pass without changing the host's global tool installation.

Independent Codex autoreview identified six client generation/reconnect/result defects during development; ClawSweeper subsequently identified a key-only deletion-event rebinding defect. Every accepted finding received failing-before proof and an owner-level repair. The final event-repair review is scoped-clean through P2. The full build and subsequent integrated Gateway/UI rebuilds passed. After the final baseline-only conflict rebase, the measured startup baseline is 345,606 B gzip, 892 B above the newly lowered main baseline and 1,717 B below the maintainer-approved 347,323 B baseline. This is 340 B smaller than the preceding candidate. The 350 KiB hard baseline cap, 512 B growth allowance, 64 B variance allowance, and startup request budget are unchanged; startup uses eight JS requests.

Production LOC: +1,047/−814 (net +233). Tests/support: +2,488/−655 (net +1,833), with moved tests and extracted fixtures counted separately from production. The growth supplies a real new optimistic lifecycle owner with canonical generation/request-order facts, row-scoped rollback and confirmation-only cleanup. It is not a downstream hiding guard; duplicated deletion/navigation paths and the archive-only drain were removed, while the backend repair is net-negative.

Live proof uses an isolated development Gateway and a real disposable paired worker, not the operator's Gateway. The old server rejected deletion of an active placement. With the repair, the real browser removed the row in 16 ms, before the RPC completed; safe reclaim and deletion finished in 11,990 ms with no transport faults. A synthetic file written only on the worker survived in the managed-worktree snapshot, the checkout and worker environment were removed, and the paired device remained available with its slot released. This exercised worker-turn placement without provider inference; remote-exec is covered by the owner regression suites, not claimed as live here.

Final rebased browser proof observed removal in 61 ms while the request was still held, then navigated to a different session before forwarding the real deletion. Completion preserved that newer selection. A real expected-session-ID rejection restored the row and displayed an error after the initiating header had unmounted; a separately injected transport disconnect restored the unchanged server session without reverting navigation. Only inspected synthetic test sessions appear in attached media; no production screenshot or session data is included. The test Gateway and node were stopped after verifying cleanup.

The deletion-event repair passes 939 UI/Gateway/TUI tests across 48 files, plus 34 tests across seven full mocked-browser files. CI's stale fixtures were separately repaired with real capability publications and multi-subscriber behavior; their focused/sibling run passed 267 tests. One readonly fixture initialization and repeated goal setup were corrected during static checks without weakening assertions or raising file limits. The final conflict rebase onto 383a293b32d97254014437430b62aaf406bc11ac reran 223 tests across ten files, including deletion generations, shell navigation, incognito reset and original-order worker cleanup. Git range-diff confirms the reviewed production/test patches are unchanged; only the measured startup-baseline metadata differs.

A second real-Gateway browser fault sequence deletes A, recreates B at the same key, then delivers A's actual deletion payload after B is visible. Transport sequence numbers are kept continuous to model delayed publication, not packet loss. Before the repair, B disappeared and navigation moved away while B still existed on the server. Afterward, the event retains A's ID and B's row, navigation, and typed draft survive. The initial raw-frame hold triggered transport recovery and is not counted as the reproduction.

Final build, independent review, exact-head CI, measured LOC, and the final live verdict are recorded in the land-ready proof comment.

Provenance: await-then-refresh deletion was carried forward by #117103 (session/navigation reconnect refactor); the mutation-time publication guard came from #125018 (duplicate Sessions-page query fix); revision-only prefetch validation came from #125128 (instant transcript snapshots). The outer reclaim map came from #108398 (cloud worker run/reclaim), and premature placement retirement from #120715 (fallback-disconnect cleanup). The blamed code, PR authorship, and merge attribution for those changes all resolve to @steipete. Active-placement deletion refusal was intentional prior policy, not a newly attributed regression; changing it to safe reclaim was explicitly approved.

Scope boundary

Related but not fixed: #127388, where pending archive publication failures can poison unrelated cleanup and starve recovery. This change reconciles UI membership after rejection rather than claiming that server state rolled back, but deliberately does not redesign the durable archive retry/completion policy.

Two named follow-ups were recorded during the audit. Android's pre-existing ChatController delete-event consumer still purges offline cache/outbox state by key/agent rather than generation; its native persistence lifecycle needs a separate repair and proof, and is not claimed fixed here. The mock Gateway's global defaults also need coherent per-session main/history/pin facts; this PR corrects only the causally failing browser scenarios without removing deliberate stale-ID fault fixtures.

@clawsweeper

clawsweeper Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes commands Command implementations size: XL maintainer Maintainer-authored PR labels Aug 29, 2026
@steipete
steipete marked this pull request as ready for review August 29, 2026 00:24
@steipete

steipete commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Live deletion proof

The isolated development Gateway and disposable paired worker exercised the real deletion path. The old server refused an active worker placement; the repaired path removed its row in 16 ms, completed safe reclaim/deletion in 11,990 ms, and preserved a file that existed only on the worker in the managed-worktree Git snapshot. The checkout, session, and worker environment were removed; the paired device stayed available and its worker slot was released. No provider inference or paid cloud VM was used.

Before the final baseline-only conflict rebase, the browser removed a normal session in 61 ms while its request was still held. I opened another session, forwarded the unchanged request to the real Gateway, and verified completion did not replace the newer navigation. Separate negative flows verified row restoration after transport interruption and a visible real server rejection after the initiating header had unmounted. The recordings use asserted UI states, not sleeps for synchronization.

Attached media, in order:

  1. Before: the old UI retained a row while Delete was pending.
  2. After: immediate removal, newer navigation, and real server completion.
  3. Real paired-worker safe deletion, without transport faults.
  4. A rejected deletion restores the row and shows the error after navigation.

All media were inspected and contain synthetic test sessions only. The original reported screenshot and production session data are not included. Both development processes were stopped after cleanup. Remote-exec placement has regression-test coverage; this live worker run exercised worker-turn placement.

Build/ownership evidence: full build passed; integrated Gateway runtime and UI rebuilds passed; rebased owner/shell tests passed 206/206; native request tests passed 34/34; independent autoreview is scoped-clean through P2. The final rebased UI measures 345,606 B gzip / eight startup JS requests: +892 B from the newly lowered main baseline, but 1,717 B below the explicitly approved 347,323 B baseline and 340 B smaller than the preceding candidate. The hard ceiling and growth/variance allowances remain unchanged. The later producer-owned deletion-generation repair has separate before/after evidence and is included in the current PR head.

Final conflict-rebase head: 97dbc44982dbe5c50c4a95f080a9c37b74860cb9, based on 383a293b32d97254014437430b62aaf406bc11ac. Git range-diff confirms the independently reviewed production/test patches are unchanged; only startup-baseline metadata changed. The integrated rerun passed 223 tests across ten files, plus 15 browser tests across the complete delete/archive files. Core, test and UI typechecks, lint, and the final guard plan all pass. UI compilation succeeded; the first build wrapper failed only the obsolete size limit, and the canonical performance check passed after recording the fresh lower measurement.

Integration commands:

OPENCLAW_VITEST_MAX_WORKERS=4 node scripts/run-vitest.mjs ui/src/lib/sessions/session-delete-mutations.test.ts ui/src/lib/sessions/session-deletion-generations.test.ts ui/src/lib/sessions/index.test.ts ui/src/lib/sessions/index.event-refresh.test.ts ui/src/lib/sessions/reconcile.test.ts ui/src/app/app-host.deleted-session.test.ts src/gateway/server.sessions.reset-hooks.test.ts src/gateway/server.sessions.delete-state-lifecycle.test.ts src/gateway/server.sessions.delete-lifecycle.test.ts src/gateway/server.sessions.worker-original-order.test.ts
node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/session-management.delete.e2e.test.ts ui/src/e2e/session-management.archive.e2e.test.ts
node scripts/check-changed.mjs -- src/gateway/session-reset-service.ts ui/src/lib/sessions/session-placement-recovery.ts config/control-ui-startup-budget-baseline.json

Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/33231351525. The exact-head workflow completed successfully on attempt 1, including the required openclaw/ci-gate. The macOS job waited for capacity, then passed on its original runner path. A targeted retry request was rejected while queued; the subsequent cancellation safety check detected runner acquisition and stopped before any cancellation or restart. Native review guards/artifacts are refreshed and the candidate is ready for native prepare/merge; this comment does not yet claim a merge. The latest ClawSweeper finding is resolved; its retained-checkout history limitation is covered by the complete local base-to-head history and range comparison. Direct sibling-Codex inspection was repeated against pinned 0.150.1 source at 90854393966b21e9ebfd21b122334eb09a20c93d: unsubscribe statuses and connection ownership, connection-specific subscription removal, and the distinct destructive native thread-delete handler. The PR has no diff under extensions/codex; its existing session-retirement owner still rejects supervision-owned or actively claimed bindings, preserves surviving thread owners, and releases only the retired subscription after commit. The generic inference-control change only renames the archive-specific comment to session lifecycle. No native thread-delete RPC or Codex protocol change is introduced. No SQLite schema/table/version change occurred (native schema guard passes at v13). The existing archive-publication backlog issue #127388 and named Android/mock-Gateway follow-ups remain explicit non-goals, not claimed fixes.

Before: deleted row remains visible while cleanup is pending

session-delete-final-navigation.mp4
session-delete-worker-after.mp4

Rejected deletion restores the row and displays an error after navigation

@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 29, 2026
@clawsweeper

clawsweeper Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 11:34 PM ET / August 29, 2026, 03:34 UTC.

ClawSweeper review

What this changes

The PR makes Control UI session deletion immediate while the Gateway drains and safely reclaims attached cloud workers before committing the delete.

Regression provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this maintainer-authored PR open for its normal merge path. The reviewed Gateway and Control UI owners correctly preserve delete generation identity and avoid stale-row resurrection; exact-head CI and the required Codex-runtime inspection remain incomplete in this review environment.

Priority: P1
Reviewed head: 97dbc44982dbe5c50c4a95f080a9c37b74860cb9

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The supplied proof and source-level generation guards are substantial, but complete confidence is limited by unavailable introduction history and Codex-contract inspection.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This maintainer-authored PR supplies isolated browser and worker evidence in its discussion; GitHub-hosted media could not be independently retrieved because DNS was unavailable, which is a reviewer limitation rather than a contributor-proof failure.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR supplies isolated browser and worker evidence in its discussion; GitHub-hosted media could not be independently retrieved because DNS was unavailable, which is a reviewer limitation rather than a contributor-proof failure.
Evidence reviewed 7 items Gateway delete identity: The delete handler publishes the lifecycle result’s deleted session ID, and the event broadcaster emits delete payloads without loading a row that may now occupy the same key.
Current-main contrast: Fetched current main still enriches keyed events by loading the current row; this branch adds the delete-specific bypass.
Client generation guard: The client ignores key-only delete events and refuses to remove a row when the event session ID differs from the current generation.
Findings None None.
Security None None.

How this fits together

The Control UI sends session-delete requests to the Gateway, which owns persistent session state and cloud-worker cleanup. Session events and refreshed rosters then update sidebars, open chat panes, and the Sessions page.

flowchart LR
  UI[Control UI delete action] --> Optimistic[Optimistic session owner]
  Optimistic --> Gateway[Gateway deletion request]
  Gateway --> Drain[Worker drain and reclaim]
  Drain --> Store[Session lifecycle commit]
  Store --> Events[Session change events]
  Events --> Views[Sidebar, chat pane, sessions page]
Loading

Before merge

  • Resolve merge risk (P1) - The PR changes persistent-session cleanup, worker placement retirement, and optimistic client state; its exact head still has incomplete CI in the supplied state.
  • Resolve merge risk (P1) - Codex supervision changes cannot receive the repository-required direct sibling-Codex contract inspection while that checkout and its remote are unavailable.
  • Complete next step (P2) - Maintainership and missing exact-head/Codex-boundary evidence require a human merge review rather than automated repair routing.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta production +1,047/−814 (net +233); tests/support +2,488/−655 (net +1,833) The bug fix adds a dedicated optimistic deletion owner across Gateway and Control UI, so the added lifecycle surface needs merge-time scrutiny.

Stored data model

Persistent data-model change detected: durable storage schema: src/gateway/worker-environments/inference-control.test-helpers.ts, durable storage schema: src/gateway/worker-environments/placement-dispatch-test-harness.ts, durable storage schema: src/gateway/worker-environments/placement-dispatch.ts, durable storage schema: src/gateway/worker-environments/session-placement-lifecycle.ts, serialized state: src/commands/sessions-lifecycle.ts, serialized state: src/gateway/server-methods/session-change-event.ts, and 34 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #132057
Summary: This PR is the candidate fix for the reported Control UI deletion behavior; the archive-publication backlog remains distinct.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Complete exact-head verification (recommended)
    Finish CI and repeat the Codex-boundary inspection against the current head before merge because the branch coordinates session state and Codex-supervision lifecycle code.
  2. Pause the broader branch
    Pause this branch if the included Codex supervision edits cannot be independently validated as part of this repair.

Technical review

Best possible solution:

Keep the generation-aware delete path and complete exact-head CI plus direct Codex-boundary inspection before merge.

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

Yes: fetched current main enriches keyed lifecycle events from the current row, while the branch's generation-carrying delete path and focused tests demonstrate the stale-replacement sequence from source.

Is this the best way to solve the issue?

Unclear: the Gateway-to-client generation handoff is the appropriate owner-boundary solution, but the included Codex runtime changes require the unavailable direct Codex inspection for a complete best-fix verdict.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 826c1660d5b3.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P1: The change addresses a visible session-delete workflow that can appear ineffective while cleanup is slow.
  • merge-risk: 🚨 session-state: Merging alters session deletion, delayed lifecycle events, and worker-placement retirement across persisted and optimistic state.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR supplies isolated browser and worker evidence in its discussion; GitHub-hosted media could not be independently retrieved because DNS was unavailable, which is a reviewer limitation rather than a contributor-proof failure.

Evidence

What I checked:

Likely related people:

  • steipete: Available blame assigns the delete-event producer and delete-only broadcaster branch to Peter Steinberger; supplied merged history also identifies this account across the session and worker lifecycle. (role: recent area contributor; confidence: high; commits: 97dbc44982db, 7bae24760b09, 126b549a26ad; files: src/gateway/server-methods/sessions-delete.ts, src/gateway/server-methods/session-change-event.ts, ui/src/lib/sessions/index.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete exact-head CI.
  • Record a direct sibling-Codex review of the changed supervision protocol path.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-29T00:35:06.347Z sha 81ddc63 :: needs changes before merge. :: [P1] Preserve delete-event generation before filtering a recreated session
  • reviewed 2026-08-29T01:28:57.137Z sha 3c1e2f0 :: needs changes before merge. :: [P1] Carry the deleted identity into delete-event filtering
  • reviewed 2026-08-29T02:41:50.341Z sha b2d3fe70298e74eeafea2be0ab6ab7a707edccc6 :: needs maintainer review before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

ClawSweeper deletion-generation finding addressed

Fixed in b2d3fe7. The removed sessionId now comes from the actual delete/incognito-reset lifecycle result. Neither leading nor trailing delete broadcasts reload the current row. The destructive UI merge checks the event's generation before removing anything; key-only lifecycle signals invalidate the roster rather than confirm deletion of its current occupant.

Both rank-up moves are covered: producer-owned identity and a failing-before delayed-delete-after-recreation regression. The focused shell cases cover subscription/direct delivery, identified/key-only events, and the absence of any prior local deletion. They preserve B's row, navigation, draft and queue, then prove a genuine B deletion still retires B. Real RPC-to-SQLite-to-emitter coverage recreates B before broadcast and proves the event retains A's identity without borrowing B's snapshot. Incognito reset and the dynamic lifecycle bridge are covered too.

Fault-injected real-Gateway browser proof: delete A, create B at the same key, wait for canonical B and enter a draft, then deliver A's actual deletion payload late. The delivery envelope keeps continuous sequence numbers to model delayed publication rather than packet loss. This distinction matters: an initial raw-frame hold triggered transport recovery and was not the reproduction. Before the fix, B vanished and navigation moved Home even though the server still held B. After the fix, the notification retains A's ID and B's row, navigation, and typed draft remain. The two attached videos show before and after; only idle setup was trimmed, and all media were inspected. Synthetic sessions only, with the proof session and dev Gateway cleaned up afterward.

Verification: 939 UI/Gateway/TUI tests across 48 files, plus 34 tests across seven full browser files, pass. The final fixture cleanup was rerun. Gateway/UI builds pass and independent autoreview is scoped-clean through P2. The event fix adds a judged 26 production lines for authoritative metadata and the two destructive-generation/no-enrichment boundaries; duplicate observation and the old separate null-result delete branch were removed. There is no SQLite table/schema/version change, new store, configuration option, protocol-version bump, or native Codex history deletion.

The final measured startup baseline is 345,946 B (+575 B from the integrated baseline, within the previously approved 862 B adjustment); hard ceiling, growth/variance allowances, and eight startup requests are unchanged. The PR body records the pre-existing Android offline-cleanup and mock-Gateway metadata follow-ups rather than claiming those separate owners are fixed.

Exact-head CI remains a separate merge gate; this comment does not claim it is green or bypass it.

late-delete-before-trimmed.mp4
late-delete-after-trimmed.mp4

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 29, 2026
Remove confirmed selections optimistically, retain canonical generation ownership across stale responses and reconnects, and reconcile failures without restoring old navigation. Share archive/delete lifecycle drains and safely reclaim worker workspaces before deletion commits. Preserve exact caller, session, and placement authority through asynchronous cleanup.

Fixes #132057.
Use real session capability publications, support independent subscribers, assert postcommit placement retirement, and distinguish selected threads from the configured main session in browser fixtures. Preserve archived-action and geometry assertions.
Carry deleted session identity from lifecycle results, skip current-row enrichment for deletion broadcasts, and reconcile key-only notifications without purging a replacement. Cover delayed events, incognito reset, and the real RPC-to-broadcast boundary. Record the final measured startup baseline within the approved adjustment.
@steipete
steipete force-pushed the steipete/session-deletion-bug-9fc12c branch from b2d3fe7 to 97dbc44 Compare August 29, 2026 03:25
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 29, 2026
@steipete
steipete merged commit 09be104 into main Aug 29, 2026
264 checks passed
@steipete
steipete deleted the steipete/session-deletion-bug-9fc12c branch August 29, 2026 05:47
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 30, 2026
…penclaw#132233)

* fix(sessions): delete immediately and safely reclaim workers

Remove confirmed selections optimistically, retain canonical generation ownership across stale responses and reconnects, and reconcile failures without restoring old navigation. Share archive/delete lifecycle drains and safely reclaim worker workspaces before deletion commits. Preserve exact caller, session, and placement authority through asynchronous cleanup.

Fixes openclaw#132057.

* test(sessions): align fixtures with canonical deletion ownership

Use real session capability publications, support independent subscribers, assert postcommit placement retirement, and distinguish selected threads from the configured main session in browser fixtures. Preserve archived-action and geometry assertions.

* fix(sessions): bind delete events to the removed generation

Carry deleted session identity from lifecycle results, skip current-row enrichment for deletion broadcasts, and reconcile key-only notifications without purging a replacement. Cover delayed events, incognito reset, and the real RPC-to-broadcast boundary. Record the final measured startup baseline within the approved adjustment.
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 cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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.

Control UI session deletion waits for cleanup and can leave stale rows Pending archive failures poison unrelated session deletes and starve recovery

1 participant