Repository navigation
fix(sessions): keep conversations with enabled automations from automatic archiving - #196297
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 conversations with enabled parent-linked automations from automatic archiving and defers archiving while automation protection loads. Example: A dashboard conversation owns an enabled weekly report and remains idle for 8 days.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a current-main retention gap, and the previous hot-reload finding is resolved; no actionable findings remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway's cron owner supplies enabled jobs to session-maintenance preservation; the shared planner and commit checks use those facts to decide which session rows may be archived. flowchart TD
A[Cron job owner] --> B[Exact parent resolution]
B --> C[Maintenance preservation snapshot]
D[Cron loading state] --> C
C --> E[Shared maintenance planner]
E --> F[Live protection commit checks]
F --> G[Session store]
Technical reviewBest possible solution: Merge the cron-owned preservation provider and shared loading deferral once the existing CI gates pass. Do we have a high-confidence way to reproduce the issue? Current-main maintenance can archive an unprotected idle dashboard parent, and scheduled admission classifies that parent as archived and pauses its job; supplied Gateway evidence exercises the repaired flow, but this review ran no target code. Is this the best way to solve the issue? Preserving parents at the shared maintenance boundary fixes the cause while retaining explicit archive/delete pauses, existing retention settings, and occurrence authorization checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against be9444ea8617. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +125, Tests +168, Docs 0, Other +2. Total +295 across 20 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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:
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 HistoryReview history (4 earlier review cycles)
Reviewed November 9, 2026, 8:41 PM ET / November 10, 2026, 01:41 UTC (Revision 5). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…atic archiving (openclaw#196297) * fix(sessions): keep conversations with enabled automations from automatic archiving * fix(sessions): defer automatic archiving until automations have loaded * fix(sessions): warn once when a failed cron load pauses automatic archiving * fix(sessions): keep automation parents protected across cron hot reloads * fix(sessions): release archiving deferral when a reload disables cron * chore(test): allocate test-line growth for automation parent retention
…atic archiving (openclaw#196297) * fix(sessions): keep conversations with enabled automations from automatic archiving * fix(sessions): defer automatic archiving until automations have loaded * fix(sessions): warn once when a failed cron load pauses automatic archiving * fix(sessions): keep automation parents protected across cron hot reloads * fix(sessions): release archiving deferral when a reload disables cron * chore(test): allocate test-line growth for automation parent retention Carry adaptation for v2026.11.5-beta.4: the index keeps the carry's resolveCronJobBoundSessionKeys (main renamed it resolveCronJobSessionBindings), and the new maintenance test reads beta.4's one-argument classifyScheduledParent(row), which returns a live row where main returns "current". (cherry picked from commit ac79724)
Alex, room openclaw#620. Of the 72 11.3..11.4 commits the census counted as production changes, six main fixes are ported: openclaw#187499, openclaw#187653, openclaw#188023, openclaw#195400, openclaw#196297 and openclaw#197960. PORTING-NOTES.md, "The 72 11.4 repairs reviewed against the carry", records each deferral with its reason, the two UNSURE outcomes, and the M4 qualification.
…enclaw#196297) Backport of ac79724. Release adaptation: preserve existing display index binding API; adopt maintenance provider, pending-load lifecycle and commit revalidation. Exclude docs and allocation metadata. No schema or retention-policy redesign. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 877a25cd07c2a134b5e1aace6a5a139d734bfe56)
Fixes #187590
What Problem This Solves
Fixes: an automation created in a dashboard chat pauses on its own when automatic session maintenance archives that chat for being idle. This happens after 7 days by default, or through
pruneAfterormaxEntries.User Impact
User impact: a conversation that created an enabled automation is no longer archived by automatic maintenance, so weekly reports, watchers and reminders keep running even if nobody opens the chat. Disabling or removing the automation makes the chat eligible again. Archiving or deleting the chat yourself still asks for confirmation (#184818) and still pauses its automations (#178965).
Why This Change Was Made
Since #178965, an automation pauses when the conversation that created it is archived. Scheduled runs never touch that conversation (#185341), so it looks idle to maintenance. This PR registers a session-maintenance preserve provider fed from the cron service's loaded jobs. It uses the same mechanism as pinned rows and active work, so stale-dashboard archiving, age retention and the entry cap all honor it.
Only enabled jobs protect a chat, and only the exact creating conversation. The provider resolves that conversation with
resolveScheduledPrincipal, the same call occurrence admission uses before it pauses. Wake, delivery and run-session bindings don't pin anything.Under
maxEntries, a protected chat still counts toward the cap, the same as a pinned chat. If protection prevents reaching the cap, the store stays above it, as documented.No new config option. Docs are updated in
docs/gateway/config-agents/sessions.mdanddocs/automation/cron-jobs/delivery.md.Gateway startup: cron loads its jobs in the background, after post-ready maintenance has started. A preserve provider can now report
isPending(). While any provider is pending, the snapshot carriesarchivingDeferredand the planner skips only the archiving actions: stale-dashboard,pruneAfterage andmaxEntriescap. Everything else runs as today, including removal of disposable runtime rows. The planner change is generic; nothing in it is cron-specific.cronEnabled=false, which clears any leftover pending state, so archiving isn't paused for the rest of the process.cron.enabled: falseorOPENCLAW_SKIP_CRON=1), or no cron service is created, the provider never becomes pending, so archiving proceeds. A disabled scheduler still loads its jobs, and the parents of enabled jobs stay protected. That's deliberate: re-enabling cron must not find those jobs paused because maintenance archived their chats while it was off.maxEntriesuntil cron starts. The Gateway logs one warning per process:automatic session archiving is paused: automations failed to load. There are no timers or retries; a later successful start, such as a config reload or restart, resumes archiving.Known limits:
openclaw sessions cleanup --dry-runruns without the Gateway's jobs.--enforceruns in the Gateway and honors the protection.Evidence
node scripts/run-vitest.mjs run src/gateway/session-automation-index.maintenance.test.ts src/gateway/session-automation-index.test.ts: 20 passed. The tests cover each of the stale-dashboard,pruneAfterandmaxEntriesphases:classifyScheduledParentstill reportscurrent.isPendingforced to false, the three deferral tests fail.store.pruning,store-maintenance.dashboard-archive, thesession-accessor.sqlite-maintenance-{kick,cap,worker,writer}tests,cleanup-service.{cap-archive,deferred-sources}andsqlite-exact-read: 9 files passed.pnpm tsgo:core,pnpm tsgo:core:test, oxlint and oxfmt on changed files: clean.sessions.cleanup --enforce.okand stays enabled.config/test-lines-allocations/196297-automation-parent-retention.txtgrants exactly that, aschecks-fast-baseline-ratchetsrequires.6b7c92c9. The final head89097433changes only the test-line allocation file; no runtime, test or doc file differs from the proven head:run_94e3713e8a808a96b20bd63fbff0b901, leasecbx_c5d662ff7d0e(c7a.8xlarge, us-east-1). Exit 0; the lease is released.crabbox run --provider aws -- bash proof.sh. The script runs the QA scenario, then the upgrade script.cron-automation-parent-retention(real Gateway, mock-openai,archiveDashboardAfter: 6s), 5/5 steps passed:sessions.cleanup --enforce.ok, reaches the model, and stays enabled.doctor --fix, then the PR build witharchiveDashboardAfter: 5s). All 8 checks passed, 0 failed:ok, reaches the model and stays enabled.stale-dashboard). Its job, once re-enabled, pauses with the archived-parent notice, which shows the parent link survived the upgrade.Upgrade proof results.jsonl (abridged)