Repository navigation
fix(sessions): preserve personally pinned sessions during automatic cleanup - #180610
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherProfile 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]
Technical reviewBest 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
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +382, Tests +246. Total +628 across 34 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 22, 2026, 8:59 AM ET / 12:59 UTC. |
|
Merged via squash auto-merge.
|
…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]>
…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
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
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.