Repository navigation
fix: keep automations running when someone renames a session group or edits sharing - #201434
Conversation
…ifications - Session group renames/deletes and sharing edits publish an unkeyed sessions catalog notification after their committed writers install row facts. Prepared delivery generations treated it as a row invalidation, so every in-flight cron, restart-recovery and session-event run on the Gateway failed with SESSION_DELIVERY_GENERATION_UNAVAILABLE. - Mirror the sharing-preparation owner (d53921a): ignore the plain notification once facts are retained; factsInvalidated or runtimeSession notifications still invalidate.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Observed proof (isolated Gateways, deterministic local model fixture; private paths and session ids trimmed). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesPreserve prepared session delivery generations across plain session-list notifications from group and sharing edits. Example: Rename a session group while an unrelated scheduled agent turn awaits a 30-second model response.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR: it fixes a verified automation failure still present on fetched main, and the focused change has convincing Gateway evidence with no actionable findings. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherSession-event admission retains a delivery lease; committed row publications and catalog notifications enter its listener, which determines whether background execution can continue. flowchart TD
A[Group or sharing edit] --> B[Committed storage writer]
B --> C[Exact row facts]
B --> D[Session list notification]
C --> E[Delivery generation lease]
D --> E
E --> F[Background turn and delivery]
Technical reviewBest possible solution: Merge the focused lease correction after the existing exact-head gates pass, preserving committed-fact and source checks. Do we have a high-confidence way to reproduce the issue? Supplied Gateway traces reproduce the rename-triggered failure on the pinned baseline, and fetched main retains the responsible code; this review executed no target code. Is this the best way to solve the issue? The smallest complete fix belongs in the existing lease listener: disregard the redundant catalog notification after retaining facts, while leaving exact publications and real invalidations effective. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ad550e953a9b. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +10, Tests +4. Total +14 across 2 files. Added test files: 0. 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. 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 November 18, 2026, 3:11 PM ET / 20:11 UTC. |
|
Maintainer override: the only red on ff77fa1 is PostgreSQL conformance (2/4), case
|
|
Merged in 04e8a7a. A session group rename or delete, or a sharing edit, no longer cancels every in-flight session-event run on the Gateway (cron runs, restart-recovery turns): the delivery-generation lease now ignores the broad sessions-changed notification once its facts are retained, the same rule the sharing preparation already uses. Notifications that really invalidate facts or the runtime session still do. Thanks @jorge-monalee and @hvhoon for the reports on #185085 and #186361; they stay open for the parts this PR does not cover. |
… edits sharing (openclaw#201434) Root cause: src/config/sessions/session-delivery-generation.ts:192 treats the unkeyed `{ all: true, scope: "sessions" }` session-list notification as a stored-row invalidation, so one sidebar group rename or sharing edit retires the delivery generation of every in-flight run on the Gateway. Related: openclaw#185085, openclaw#186361 ## What Problem This Solves A scheduled automation, a restart-resumed reply or another background session turn can fail partway through with `Session delivery generation is unavailable; retry after session storage is ready.` when anyone renames or deletes a session group or edits session sharing, even in an unrelated chat. The run ends as an error and its reply is lost. ## User Impact User impact: renaming or deleting a session group, or changing who a session is shared with, no longer kills automations and background turns that are running in other sessions. ## Why This Change Was Made Group and sharing handlers publish an unkeyed session-list notification after their storage writers have already published the exact per-session facts. The sharing-preparation owner already treats that plain notification as harmless once its facts are retained (4d6df47, "shared-session runs lose access after session list updates"). The delivery-generation lease is the other consumer of the same notification and still invalidated on it. It now applies the same rule: a plain `sessions` notification is ignored once the lease has retained facts, and every later check still reads the retained source and current facts. Notifications that carry `factsInvalidated` or a `runtimeSession` still invalidate, as before. The change is in the lease, not in each publisher, so group rename, group delete and sharing edits are all covered without changing what clients receive. ## Evidence - Production (Team Gateway, 14 days, read-only journal): 28 lines with this error. All of them come from session-event runs (cron `lane=cron-nested` / `source=cron`: 14, restart-recovery turns: 13, one webchat follow-up). The first attempt had been running for 19 s to 91 min before it failed, and several sessions failed in the same second, which points to one Gateway-wide invalidation rather than a per-session write. No exec-completion, subagent or channel-send callers. - Isolated Gateway, deterministic local Responses fixture, cron job bound to a session whose turn takes 30 s, `sessions.groups.rename` called mid-run. Observed lines: openclaw#201434 (comment) - main d28eb7d (source and dist): every run that overlapped a rename failed with `Session target preparation outlived its attempt | admitted run authority is no longer active | Session delivery generation is unavailable` and `session event execution failed source=cron`, the same lines Team logs. - this branch ff77fa1 (source and dist): all cron runs finish `ok` with the same renames. - control, main without the rename: the cron run finishes `ok`. - Regression: `session-delivery-generation.native.test.ts` emits the unkeyed `sessions` notification on a prepared lease; red on main, green here. The same test checks that a `factsInvalidated` notification still retires the lease. - Adjacent suites pass: delivery-generation diagnostics/incarnation/registry, sessions-sharing, sessions-groups, session-sharing-publication integration, sessions-rewind local-workspace handoff, sessions-mutations catalog-queue. ## Merge danger Two-way door: one guard in the lease, no stored state, schema or config. If it were wrong, a run could keep a delivery generation across a group or sharing edit, but every effect still re-reads the retained source and the current row facts (membership, category, entry and permission changes are published per session and keep invalidating). Blast radius: in-flight session-event runs (cron, restart resume, exec completions) during session-list edits. Thanks @jorge-monalee and @hvhoon for the detailed reports of runs dying with this error. Co-authored-by: Ayaan Zaidi <[email protected]>
… edits sharing (#201434) Root cause: src/config/sessions/session-delivery-generation.ts:192 treats the unkeyed `{ all: true, scope: "sessions" }` session-list notification as a stored-row invalidation, so one sidebar group rename or sharing edit retires the delivery generation of every in-flight run on the Gateway. Related: #185085, #186361 ## What Problem This Solves A scheduled automation, a restart-resumed reply or another background session turn can fail partway through with `Session delivery generation is unavailable; retry after session storage is ready.` when anyone renames or deletes a session group or edits session sharing, even in an unrelated chat. The run ends as an error and its reply is lost. ## User Impact User impact: renaming or deleting a session group, or changing who a session is shared with, no longer kills automations and background turns that are running in other sessions. ## Why This Change Was Made Group and sharing handlers publish an unkeyed session-list notification after their storage writers have already published the exact per-session facts. The sharing-preparation owner already treats that plain notification as harmless once its facts are retained (d53921a, "shared-session runs lose access after session list updates"). The delivery-generation lease is the other consumer of the same notification and still invalidated on it. It now applies the same rule: a plain `sessions` notification is ignored once the lease has retained facts, and every later check still reads the retained source and current facts. Notifications that carry `factsInvalidated` or a `runtimeSession` still invalidate, as before. The change is in the lease, not in each publisher, so group rename, group delete and sharing edits are all covered without changing what clients receive. ## Evidence - Production (Team Gateway, 14 days, read-only journal): 28 lines with this error. All of them come from session-event runs (cron `lane=cron-nested` / `source=cron`: 14, restart-recovery turns: 13, one webchat follow-up). The first attempt had been running for 19 s to 91 min before it failed, and several sessions failed in the same second, which points to one Gateway-wide invalidation rather than a per-session write. No exec-completion, subagent or channel-send callers. - Isolated Gateway, deterministic local Responses fixture, cron job bound to a session whose turn takes 30 s, `sessions.groups.rename` called mid-run. Observed lines: #201434 (comment) - main 3bc20e2 (source and dist): every run that overlapped a rename failed with `Session target preparation outlived its attempt | admitted run authority is no longer active | Session delivery generation is unavailable` and `session event execution failed source=cron`, the same lines Team logs. - this branch ff77fa1 (source and dist): all cron runs finish `ok` with the same renames. - control, main without the rename: the cron run finishes `ok`. - Regression: `session-delivery-generation.native.test.ts` emits the unkeyed `sessions` notification on a prepared lease; red on main, green here. The same test checks that a `factsInvalidated` notification still retires the lease. - Adjacent suites pass: delivery-generation diagnostics/incarnation/registry, sessions-sharing, sessions-groups, session-sharing-publication integration, sessions-rewind local-workspace handoff, sessions-mutations catalog-queue. ## Merge danger Two-way door: one guard in the lease, no stored state, schema or config. If it were wrong, a run could keep a delivery generation across a group or sharing edit, but every effect still re-reads the retained source and the current row facts (membership, category, entry and permission changes are published per session and keep invalidating). Blast radius: in-flight session-event runs (cron, restart resume, exec completions) during session-list edits. Thanks @jorge-monalee and @hvhoon for the detailed reports of runs dying with this error. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 04e8a7a) Co-authored-by: RomneyDa <[email protected]>
… edits sharing (openclaw#201434) Root cause: src/config/sessions/session-delivery-generation.ts:192 treats the unkeyed `{ all: true, scope: "sessions" }` session-list notification as a stored-row invalidation, so one sidebar group rename or sharing edit retires the delivery generation of every in-flight run on the Gateway. Related: openclaw#185085, openclaw#186361 ## What Problem This Solves A scheduled automation, a restart-resumed reply or another background session turn can fail partway through with `Session delivery generation is unavailable; retry after session storage is ready.` when anyone renames or deletes a session group or edits session sharing, even in an unrelated chat. The run ends as an error and its reply is lost. ## User Impact User impact: renaming or deleting a session group, or changing who a session is shared with, no longer kills automations and background turns that are running in other sessions. ## Why This Change Was Made Group and sharing handlers publish an unkeyed session-list notification after their storage writers have already published the exact per-session facts. The sharing-preparation owner already treats that plain notification as harmless once its facts are retained (d53921a, "shared-session runs lose access after session list updates"). The delivery-generation lease is the other consumer of the same notification and still invalidated on it. It now applies the same rule: a plain `sessions` notification is ignored once the lease has retained facts, and every later check still reads the retained source and current facts. Notifications that carry `factsInvalidated` or a `runtimeSession` still invalidate, as before. The change is in the lease, not in each publisher, so group rename, group delete and sharing edits are all covered without changing what clients receive. ## Evidence - Production (Team Gateway, 14 days, read-only journal): 28 lines with this error. All of them come from session-event runs (cron `lane=cron-nested` / `source=cron`: 14, restart-recovery turns: 13, one webchat follow-up). The first attempt had been running for 19 s to 91 min before it failed, and several sessions failed in the same second, which points to one Gateway-wide invalidation rather than a per-session write. No exec-completion, subagent or channel-send callers. - Isolated Gateway, deterministic local Responses fixture, cron job bound to a session whose turn takes 30 s, `sessions.groups.rename` called mid-run. Observed lines: openclaw#201434 (comment) - main 3bc20e2 (source and dist): every run that overlapped a rename failed with `Session target preparation outlived its attempt | admitted run authority is no longer active | Session delivery generation is unavailable` and `session event execution failed source=cron`, the same lines Team logs. - this branch ff77fa1 (source and dist): all cron runs finish `ok` with the same renames. - control, main without the rename: the cron run finishes `ok`. - Regression: `session-delivery-generation.native.test.ts` emits the unkeyed `sessions` notification on a prepared lease; red on main, green here. The same test checks that a `factsInvalidated` notification still retires the lease. - Adjacent suites pass: delivery-generation diagnostics/incarnation/registry, sessions-sharing, sessions-groups, session-sharing-publication integration, sessions-rewind local-workspace handoff, sessions-mutations catalog-queue. ## Merge danger Two-way door: one guard in the lease, no stored state, schema or config. If it were wrong, a run could keep a delivery generation across a group or sharing edit, but every effect still re-reads the retained source and the current row facts (membership, category, entry and permission changes are published per session and keep invalidating). Blast radius: in-flight session-event runs (cron, restart resume, exec completions) during session-list edits. Thanks @jorge-monalee and @hvhoon for the detailed reports of runs dying with this error. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 04e8a7a) Release adaptation: Source guard/test unchanged; exact4-line regression allocation. Runtime native suite setup stalled before tests; proof pending, not validated. Co-authored-by: RomneyDa <[email protected]>
… edits sharing (#201434) Baseline adaptation: Keep retained leases on ordinary session-list notices; preserve explicit invalidation and live source checks in the shipped owner. (cherry picked from commit 04e8a7a) Co-authored-by: RomneyDa <[email protected]>
When neither the selected endpoint nor the model row declares input, ClawRouter's fallback classified gpt-6.2-sol and gpt-6.2-astra as text-only. Add both upstream IDs and cover them in the fallback test. (cherry picked from commit 3bc20e2) Release adaptation: Cite the original PR’s November 18, 2026 live ClawRouter image proof in the legacy fallback; exact upstream IDs, explicit modality precedence, and text-only behavior for unrecognized models are unchanged. Follow-up audit: #205137’s catalog clock fixture is already equivalent (70a36ea), and #203898 is already integrated (fec6728). #207768 classifies catalog misses and #192450 adds Bedrock routing; neither is required by the exact-ID fallback. #201434 and #201415 mention the donor SHA as an unrelated verification baseline. Original #200878 has no additional follow-up reference at the pinned scan end. Co-authored-by: RomneyDa <[email protected]>
Root cause: src/config/sessions/session-delivery-generation.ts:192 treats the unkeyed
{ all: true, scope: "sessions" }session-list notification as a stored-row invalidation, so one sidebar group rename or sharing edit retires the delivery generation of every in-flight run on the Gateway.Related: #185085, #186361
What Problem This Solves
A scheduled automation, a restart-resumed reply or another background session turn can fail partway through with
Session delivery generation is unavailable; retry after session storage is ready.when anyone renames or deletes a session group or edits session sharing, even in an unrelated chat. The run ends as an error and its reply is lost.User Impact
User impact: renaming or deleting a session group, or changing who a session is shared with, no longer kills automations and background turns that are running in other sessions.
Why This Change Was Made
Group and sharing handlers publish an unkeyed session-list notification after their storage writers have already published the exact per-session facts. The sharing-preparation owner already treats that plain notification as harmless once its facts are retained (d53921a, "shared-session runs lose access after session list updates"). The delivery-generation lease is the other consumer of the same notification and still invalidated on it. It now applies the same rule: a plain
sessionsnotification is ignored once the lease has retained facts, and every later check still reads the retained source and current facts. Notifications that carryfactsInvalidatedor aruntimeSessionstill invalidate, as before.The change is in the lease, not in each publisher, so group rename, group delete and sharing edits are all covered without changing what clients receive.
Evidence
lane=cron-nested/source=cron: 14, restart-recovery turns: 13, one webchat follow-up). The first attempt had been running for 19 s to 91 min before it failed, and several sessions failed in the same second, which points to one Gateway-wide invalidation rather than a per-session write. No exec-completion, subagent or channel-send callers.sessions.groups.renamecalled mid-run. Observed lines: fix: keep automations running when someone renames a session group or edits sharing #201434 (comment)Session target preparation outlived its attempt | admitted run authority is no longer active | Session delivery generation is unavailableandsession event execution failed source=cron, the same lines Team logs.okwith the same renames.ok.session-delivery-generation.native.test.tsemits the unkeyedsessionsnotification on a prepared lease; red on main, green here. The same test checks that afactsInvalidatednotification still retires the lease.Merge danger
Two-way door: one guard in the lease, no stored state, schema or config. If it were wrong, a run could keep a delivery generation across a group or sharing edit, but every effect still re-reads the retained source and the current row facts (membership, category, entry and permission changes are published per session and keep invalidating). Blast radius: in-flight session-event runs (cron, restart resume, exec completions) during session-list edits.
Thanks @jorge-monalee and @hvhoon for the detailed reports of runs dying with this error.