Repository navigation
fix(sessions): apply archive retention without cron - #182053
Conversation
|
I was independently working on #181976 and found this PR during pre-publication checks. I am holding my alternative PR to avoid duplicating this work. Your periodic-owner approach covers an important case my entry-write-only approach did not: after an actual isolated Gateway startup, expired archives remained for 65 seconds without a session write, but were removed after a normal entry-write RPC. Could we consolidate around the periodic owner and include these preservation regressions? I applied this PR's five-file patch at
These are integration observations, not confirmed failures on your raw PR head. I have not run this PR alone through a full Gateway. It would be useful to replay the last two cases on your head and agree on the intended policy before drawing conclusions. Source-wise, the directory cleanup happens before canonical pruning checks references, so checking eligibility before unlinking may be worth considering. My local alternative reuses canonical writer custody and full row-identity checks for physical removal, and preserves the recovery blob on unlink/commit failure. I can contribute the focused synthetic fixtures and this safety approach without adding another scheduler or duplicating the CLI cleanup work in #97103. The reconciled pagination combination passed 22 focused tests; #97103 itself did not apply cleanly, so I am not claiming compatibility with that PR. Would consolidating these checks into this PR be helpful? No production data, credentials, model calls, or real channel messages were used in these experiments. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR applies configured archive expiry through periodic Gateway maintenance independently of cron and cold storage. Example: Cron and cold storage are disabled, archive retention is 1h, and an unreferenced deleted archive is two hours old.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep this PR: it fixes a current retention bug, addresses all four prior findings, and has no additional concrete code defect identified. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway maintenance scheduler discovers existing session stores and passes configured expiry rules to the archive worker, which checks references and row identity before removing files and canonical rows. flowchart TD
A[Runtime configuration] --> B[Gateway maintenance scheduler]
B --> C[Session store discovery]
C --> D[Archive retention owner]
D --> E[Worker writer admission]
E --> F[Reference and identity checks]
F --> G[Archive files and database rows]
Technical reviewBest possible solution: Use the existing periodic maintenance and archive-worker owners to enforce configured expiry while preserving references, unpublished recovery copies, and bounded writer batches. Do we have a high-confidence way to reproduce the issue? Current-main source confirms both cold-storage gates and cron-dependent expiry; the linked report identifies official releases, but this read-only review ran no target code. Is this the best way to solve the issue? The repair uses existing scheduling, discovery, writer admission, and archive ownership, removes the replaced cron path, and preserves the merged pagination fix. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d4bac25d9848. Provenance checked
TestingProof path: none. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +11, Tests +76, Docs +5, Other 0. Total +92 across 21 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 HistoryReview history (2 earlier review cycles)
Reviewed October 24, 2026, 5:16 AM ET / 09:16 UTC (Revision 3). |
Preserve exact content from main ab8293d after an interrupted local merge. The following merge completes the same pinned main integration; no new implementation is introduced here.
Run configured archive expiry through the existing transcript maintenance owner. Retire cron-only retention plumbing, honor warn mode, and let the archive worker check current references and row identity before removing files and rows. Preserve legacy-file cleanup and carry runtime policy into writer admission. Fixes openclaw#181976 Co-authored-by: Yuaneen <[email protected]>
|
@clawsweeper re-review Updated this existing request for final repaired head The original P1 warn-mode and P2 protected-file findings are addressed through the existing transcript-maintenance owner and guarded archive removal. Both follow-up P2 findings are now repaired too: the generated boundary inventory relocates the same two references without increasing its allowance, and the cleanup-service regression verifies file/row expiry in one pass plus a harmless subsequent pass. Static lint/format and a fresh independent Codex review through P2 passed. The final main merge preserves the reviewed patch byte for byte. Exact-head CI is running; the PR body records the prior run's repaired failures and separate main/unclassified failures. Live Gateway/channel and upgrade E2E remain skipped under the explicit maintainer proof policy. Contributor code was not executed locally; PR CI runs the regressions. Those proof-only requests do not add a hold for this takeover. |
|
🦞👀 Re-review progress:
|
…ion-archive-retention-cron-181976
…ion-archive-retention-cron-181976
|
🦞👀 Re-review progress:
|
…82780) Initialize the title provider fixture's session store before publishing its runtime config. Eager snapshot capture otherwise leaves Gateway create/send using the default store while the test reads an empty custom store. Preserve the existing task, attachment, control-only, and manual-name proof. Related: #182053
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…enclaw#182780) Initialize the title provider fixture's session store before publishing its runtime config. Eager snapshot capture otherwise leaves Gateway create/send using the default store while the test reads an empty custom store. Preserve the existing task, attachment, control-only, and manual-name proof. Related: openclaw#182053
* fix(sessions): apply archive retention without cron * fix(sessions): keep archive retention on the accessor seam * chore: preserve verified main integration Preserve exact content from main 26472ac after an interrupted local merge. The following merge completes the same pinned main integration; no new implementation is introduced here. * test(sessions): seed archive references without arming maintenance * chore(sessions): align archive cleanup boundary baseline * test(sessions): cover owner-driven archive expiry --------- Co-authored-by: Yuaneen <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
Fixes #181976
What Problem This Solves
Configured reset/deletion archive expiry is silently skipped when cron is disabled or has no sessions to remove.
User Impact
The existing Gateway transcript-maintenance pass expires eligible archive files and canonical rows at startup and once a minute, independently of cron and cold storage. Age-based deletion honors warn mode, disabled retention, live references, and pending publication; disk-budget retention remains independent. Legacy file-only archives remain supported; no configuration or data migration is required.
Why This Change Was Made
Archive expiry belonged to a side effect of cron-run deletion, while the periodic transcript owner only admitted cold-storage work. The maintainer rewrite puts expiry in that existing owner and removes the internal cron cleanup option and forwarding path. The canonical archive worker checks references and the complete prepared row identity before unlinking; the existing writer admission checks current runtime policy immediately before the synchronous deletion batch. Legacy files use the same owner's guarded removal operation.
This addresses ClawSweeper's warn-mode and protected-file findings and removes the accessor-barrel import that caused the original PR's import-cycle/build failures. Pagination and bounded writer batches remain intact. If unlink or commit fails, the canonical recovery blob remains; a later pass can reconcile a missing derived file without introducing another transaction protocol.
The follow-up CI/ClawSweeper findings are also repaired: the generated boundary inventory now records the same two cleanup references under their new owner, and the cleanup-service regression verifies file/row expiry in one pass plus a harmless repeat. No guard allowance was increased.
Thanks @Yuaneen for the original fix and regression intent. Both contributor commits remain in the PR history.
Evidence
18105dbed6b762c9a64573836fd52989992bb248): cold-storage-only return, scheduler gate, and cron-only expiry invocation.50946220ad81561620f677ca3bb16de5c479b87e. Exact-head CI completed with 86 passed, 3 failed, and 27 skipped jobs. All three PostgreSQL conformance jobs passed. The two leaf failures below also leave the aggregate CI gate red. The two initial PR-caused validation failures are repaired and green: source contracts and cleanup-service consumer shard.Current-head CI failures:
prepare.completion-tools.test.ts:933. Verified inherited.gateway-restored-requester-settle.e2e.test.ts:178. Three trusted-main Bun runs reproduced the same failing case and expected-2/got-3 signature; Bun run 2 reports the exact:178:73frame. See the pinned-main reproduction below.Trusted-main restored-wake reproduction
Classification: inherited, main reproduces. A detached checkout was created from fresh
ls-remotemain SHA51403439b21a5736e61665e9bbd6278953a28631, and HEAD plus clean tracked source were verified before each invocation.pnpm install --frozen-lockfile --prefer-offlineand the repository-owned JavaScript runtime preparation succeeded. Onlytest/gateway-restored-requester-settle.e2e.test.tswas selected, preserving all four cases and their order. No PR-tree code was executed.The following command ran three times with the pinned Bun
1.4.4-canary.1+ef37c31de, then once withOPENCLAW_VITEST_RUNTIME=nodeon Node26.12.1:Bun reproduced consistently in 3/3 trials. The Node invocation is an infrastructure/setup gap, not a passing run or an assertion reproduction; it was not retried. The initial canceled declaration-build setup preceded these four invocations and is not counted as a test run.
Root-cause hypothesis: main #182285, commit
5d47168b9170d92c45aeb82cd7680719f211b89a(also an ancestor of this PR head), intentionally releases the shared two-slot preparation budget when a restored delivery is admitted. The owner retains settlement ownership separately; the documented contract explicitly permits this release. The fixture setsmaxConcurrent: 8but assumes a two-model-execution cap. That stale expectation can explain admission of a third wake while prior model responses are held. The earlier peak-two sample precedes the CLI probe and is not simultaneous with the later count-three assertion; request identities were not instrumented, so distinct admission versus retry is not claimed as runtime-proven. Repair belongs to the main requester-wake/test owner, outside this retention PR. No source change or push was made for this classification.The earlier missing-bootstrap-file failures did not recur on the final head; PostgreSQL 3/3 passed. They were traced to main commit 7a9a6a98, with a matching failure subsequently observed in scheduled-main PostgreSQL job 120827460249. No rerun-only fix is claimed.