Repository navigation
fix(sessions): preserve lifecycle targets during maintenance - #146749
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. Reviewed September 13, 2026, 1:02 AM ET / 05:02 UTC. ClawSweeper reviewWhat this changesThe PR prevents automatic session maintenance from archiving or pruning sessions undergoing lifecycle changes and adds regressions showing retention resumes afterward. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main lacks lifecycle-target protection during maintenance. No actionable introduced defect was found, and the maintainer-protected PR should remain open. Priority: P2 Review scores
Verification
How this fits togetherSession maintenance applies retention rules to stored conversations. It consults runtime ownership before selecting sessions to archive or remove, preserving conversations that ongoing operations still need. flowchart TD
A[Stored sessions] --> D[Maintenance preserve set]
B[Active work] --> D
C[Active lifecycle changes] --> D
D --> E[Retention selection]
E --> F[Keep protected sessions]
E --> G[Archive or prune eligible sessions]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +15, Tests +59. Total +74 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep lifecycle protection in the existing maintenance collector, using live store-scoped ownership and allowing normal retention immediately after release. Do we have a high-confidence way to reproduce the issue? Yes, from source: run automatic maintenance on an aged session while its lifecycle mutation is active; current main omits that ownership from preservation. The added SQLite regressions encode this sequence, but were not executed in this review. Is this the best way to solve the issue? Yes. Extending the shared preserve-set owner is a narrow repair that reuses existing lifecycle state and leaves retention configuration and explicit deletion intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bf3d877829d0. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Related: #130741
What Problem This Solves
Fixes automatic maintenance archiving an aged session while a lifecycle mutation still owns it.
User Impact
The session stays available during its lifecycle change, and normal retention resumes after that change finishes. Retention settings and transcript contents are unchanged.
Why This Change Was Made
The existing maintenance preserve set now includes active lifecycle ownership, matching the store scope, session key and backing session ID. Work-admission guards and explicit deletion retain their existing behavior.
Evidence
Both new regressions fail on the main preimage and pass with the fix. All 108 tests across maintenance, pruning and lifecycle admission pass on Node 24.21.0, including unrelated-session archival and resumed retention. Canonical changed checks pass and fresh P1 review is clean. This correctness split makes no Swarm latency claim.