Skip to content

fix(sessions): preserve personally pinned sessions during automatic cleanup - #180610

Merged
vyctorbrzezowski merged 8 commits into
mainfrom
brzezowski/personal-pins-retention
Oct 27, 2026
Merged

vyctorbrzezowski merged 8 commits into
mainfrom
brzezowski/personal-pins-retention

Conversation

@vyctorbrzezowski

@vyctorbrzezowski vyctorbrzezowski commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Personally pinned sidebar conversations could be automatically archived or evicted because cleanup did not recognize their saved personal pins.

User Impact

Saved sidebar, rail, and personal-group references now protect a session from automatic age/count maintenance and disk-budget eviction while any profile still pins it. Existing pin values are not rewritten, and no migration is required.

Explicit deletion and cleanup of already-published reset/deleted transcript archives keep their existing behavior. Protection begins when a pin is saved to the server; unsynchronized browser changes cannot protect server storage.

Why This Change Was Made

Cleanup reads the union of committed sidebar, rail, and personal-group session references from the existing preference owner. It coordinates pending preference writes with native cleanup settlement so a stale snapshot cannot authorize deletion. Explicit memory-session roots use their own preferences, and background maintenance keeps the runtime generation that owns its readers.

Existing session-level pins and target-wins profile preference merges retain their behavior. Related: #143719.

Evidence

  • The real cleanup regression failed before the group fix: a child was archived while another profile still kept it in a personal group. The same scenario now preserves it until the final reference is removed.
  • 49 focused cases across five files passed on the final current-main integration in 45.27 seconds. These cover the multi-profile union, both sidebar formats, group-only retention, final removal, completed and unknown native outcomes, physical disk pressure, explicit memory roots, and profile preference synchronization.
  • Production core/UI types, the three affected test-type configurations, and lint of the six revised files pass. The earlier 86-case preparation run covers the unchanged worker lifecycle and cancellation paths.
  • Independent P0–P2 review completed without findings after the group repair. Current-main API and static-view exclusions remain intact.
  • CI run 40464826402 passed for the final published head 367bb8908ea, including all three PostgreSQL conformance lanes.

Risk and coverage

This changes automatic retention eligibility, not stored pin values or deletion permissions. It introduces no schema, migration, persistent projection, or polling loop. Native cleanup retains preference protection through confirmed settlement; an uncertain outcome waits for native retirement. Existing regression cases were extended for group references; no new test harness was added. Obsolete tests already removed on main stay removed.

@clawsweeper

clawsweeper Bot commented Oct 22, 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.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: L labels Oct 22, 2026
@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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR protects sessions from automatic archival and disk eviction while any profile has a saved personal sidebar pin.

Example: Alice and Bob both pin agent:main:dashboard:keep, which has been inactive for 40 days.

  • Before: Automatic cleanup can archive or evict the session despite both personal pins.
  • After: Cleanup preserves the session until both profiles remove their pins.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The source change is coherent and has focused regression coverage, but the repository's shipped-entry-point proof requirement is not met.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A conversation can remain personally pinned in the sidebar while automatic cleanup archives or evicts its stored session.
Reason: Preserving explicitly saved conversations has clear user value, and the maintainer-authored direction retains existing preference ownership and explicit-deletion behavior.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored PR open: current main does not protect personally pinned sessions from automatic cleanup, and the patch addresses that gap without a definite introduced correctness defect.

Priority: P2
Reviewed head: abdaa76c40d2bd9e7333c80e3538134092be26dc

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No supplied shipped-Gateway scenario saves personal pins and demonstrates preservation through automatic age/count maintenance and disk-pressure eviction.
Agent review details

How this fits together

Profile preferences store personal sidebar references in the shared state database; session maintenance reads their union and carries that protection through agent-database cleanup settlement.

flowchart TD
  A[Personal sidebar pins] --> B[Profile preference owner]
  B --> C[Shared state database]
  C --> D[Prepared pin snapshot]
  D --> E[Session maintenance owner]
  E --> F[Agent database cleanup worker]
  F --> G[Settlement releases pin writers]
Loading

Technical review

Best possible solution:

Keep profile preferences authoritative and apply their saved session references through the existing maintenance and native-settlement owners.

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

Current-main source omits personal preferences from cleanup protection, and the PR reports a matching base-failing SQLite regression; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch fixes the missing protection at the existing retention boundary, preserves multi-profile ownership, and coordinates queued preference writes with cleanup settlement without introducing persistent state.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 68e67004ea1a.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit ecd7875 adds src/config/sessions/store-maintenance-preserve.ts:44 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ecd7875e3a4d; files: src/config/sessions/store-maintenance-preserve.ts)
  • Josh Avant: Raw commit 487ab99 adds src/config/sessions/store-maintenance-preserve.ts:57 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 487ab99dc237; files: src/config/sessions/store-maintenance-preserve.ts)

PR surface

Source +382, Tests +246. Total +628 across 34 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 31 543 161 +382
Tests 3 248 2 +246
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 34 791 163 +628

Labels

Label changes:

  • add P2: Personal pins currently fail to prevent automatic archival or disk eviction, affecting retained conversations under configured cleanup pressure.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Personal pins currently fail to prevent automatic archival or disk eviction, affecting retained conversations under configured cleanup pressure.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • 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 22, 2026, 8:59 AM ET / 12:59 UTC.

@vyctorbrzezowski
vyctorbrzezowski marked this pull request as ready for review October 25, 2026 21:05
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations agents Agent runtime and tooling labels Oct 25, 2026
@vyctorbrzezowski
vyctorbrzezowski enabled auto-merge (squash) October 25, 2026 21:45
@vyctorbrzezowski
vyctorbrzezowski enabled auto-merge (squash) October 27, 2026 07:11
@vyctorbrzezowski
vyctorbrzezowski merged commit c4d5fdd into main Oct 27, 2026
149 checks passed
@vyctorbrzezowski
vyctorbrzezowski deleted the brzezowski/personal-pins-retention branch October 27, 2026 07:27
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 27, 2026
…d join state reads at restart

Upstream openclaw#180610 (c4d5fdd) made automatic session maintenance read
personal session pins through an async state read, and moved upstream's own
tests from the synchronous closeOpenClawStateDatabaseForTest() to the async
closeStateDatabaseForTest(). The fork's H1 T8 restart helper still closed
synchronously while that maintenance read was in flight, so at the j8 merge
it failed with "OpenClaw state database still has active native borrowers"
(instrumented: the borrow is runPendingMaintenance ->
preparePersonalSessionPins).

The helper now joins in-flight state work like upstream's tests. Joining
must happen before the faults lift: the crashed process's pending rollback
abort otherwise completes after abortSucceeds flips, and the restart then
re-saves the crash image and aborts again (2 aborts; reproduced at J7 with
only the close change, so it is the harness, not the merge). The test
contract is unchanged: one abort after restart, no respawn.

RED (203d9e3 and 20d1129, test unchanged): native borrowers, 2 runs.
J7 1b92f87 with the old test: 1 passed.
GREEN at 20d1129 + this: 3/3 runs; same test at J7: 1 passed.

Refs karmaterminal/openclaw-bootstrap#1727

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
…leanup (openclaw#180610)

* fix(sessions): preserve personally pinned sessions during automatic cleanup

* chore(sessions): stage reviewed main conflict resolution

* fix(sessions): preserve personal pins across cleanup owners

* fix(sessions): retain pin-reader lifecycle during cleanup

* fix(sessions): bind cached personal pins to their read admission
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui commands Command implementations gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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.

1 participant