Repository navigation
fix(gateway): deliver activity-summary updates after compaction - #165024
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. |
|
@clawsweeper re-review |
|
Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 1:48 PM ET / 17:48 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR keeps Activity recap notifications alive after compaction finishes, joins accepted notifications during Gateway shutdown, and adds lifecycle regression coverage and protocol documentation. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main still inherits the producer’s cancellation scope, and the recorded Gateway run demonstrates recovered recap delivery. No actionable patch defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway generates session recaps and publishes their updated session rows to subscribed Activity clients. Its subscription owner coordinates notification delivery with session generation checks and shutdown. flowchart TD
A[Compaction or scheduled recap] --> B[Recap state changes]
B --> C{Gateway accepting notifications?}
C -->|Yes| D[Subscription-owned publication]
C -->|No| E[Notification rejected]
D --> F[Prepare current session row]
F --> G[Filter recipients and send update]
D --> H[Shutdown joins accepted work]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +8, Tests +94, Docs +2. Total +104 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep recap publication with the existing subscription owner while preserving generation checks, recipient filtering, coalescing, and shutdown settlement. Do we have a high-confidence way to reproduce the issue? Yes: the recorded isolated-Gateway compaction scenario and baseline-failing regression identify a concrete reproduction path, and current main retains the affected callback. This review inspected source and evidence without executing the scenario. Is this the best way to solve the issue? Yes: the patch repairs cancellation custody in the existing subscription owner and preserves the existing publication and authorization boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 83f4c296109b. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
What Problem This Solves
Activity clients could miss recap refreshes after successful session compaction even though the stored recap was fresh. Deferred row publication inherited the compaction or scheduler work scope, which closed before the notification reached subscribers. No later push arrived during the 110-second observation.
Why This Change Was Made
Keep accepted recap notifications with the existing Gateway subscription owner: retain any admitted root, detach only the producer's async cancellation scope, and join publication before clients and the row projection close. Reject new notifications once the scheduler/connection close prelude begins. Already accepted publication does not request new admission or wait behind suspension. Existing physical-store/generation checks, prepared-row publication, coalescing, and ordering remain in place.
User Impact
Subscribed Activity clients receive the updating and fresh recap notifications after compaction. This is release-note context for the user-visible fix. No schema, persistence, retention, SDK signature, configuration, or update migration changes are required.
Evidence
sessions.compact: baseline observed zero post-compaction recap pushes for 110.546 s, despite a fresh stored recap and a live connection. Candidate delivered exactly one fresh current recap push 66 ms after its stored update time (89.698 s after compaction), with matching text, timestamp, transcript generation,maxSeq=9, and coverage 4/4. Sequence order was updating → compact → current; no duplicate fresh-current notification. Both Gateways shut down cleanly.pnpm test src/gateway/server-runtime-subscriptions.test.ts --maxWorkers=1— 115.41 s wall; new regression 3.202 s; real-projection publication case 8.597 s, including its zero caller-thread SQL assertion. The baseline cold run took 349.93 s wall. An initial candidate run exposed a fixture-only assertion on unprojectedcompactionCount; it was corrected to the projected label.--maxWorkers=1:test/scripts/runtime-process-build-graph.test.ts,src/auto-reply/reply/get-reply.imports.test.ts,src/state/openclaw-state.worker.imports.test.ts,src/config/sessions/session-history-read.imports.test.ts,src/config/sessions/session-transcript-reconcile.imports.test.ts,src/worker/worker.runtime-imports.test.ts, andsrc/gateway/session-event-prepared-row.test.ts.node scripts/check-changed.mjs: passed, 3,677.39 s wall on the loaded host, including all 27 core test type graphs, lint, export scans, and repository guards.68ebe61752ed33c688800172dc160ebff2586f18, 29.02 s wall. Inventory T1 895 → 895; notification publication is SQL-free, while recap-generation transcript reads remain with their existing owner.OPENCLAW_*names: 0. Exact-head CI run 37220922537 passed with no failed jobs: 407 s elapsed; changed-test shard durations were 79–151 s (including setup and cleanup). Per-test CI timing was not extracted.Separate existing session-snapshot/transcript cancellation warnings remain in the synthetic workload; the activity-summary publication warnings are gone. This PR is scoped to recap notification ownership.
Overlap
Adjacent work includes #164989 (recap transcript reads) and #164922 (session lifecycle transactions), plus the sessauthtail, nativepatchtail, and delegateexec lanes. #162433 is the broad ownership-design umbrella. These changes keep minimal notification-owner hunks and do not restructure those lanes.
Released SDK surface check
Compared the production diff and latest release tag
v2026.9.8, and checkedsrc/plugin-sdk/**,src/plugins/runtime, and documented plugin subpaths. This PR changes no production function signature, sync/async contract, callback shape, or export.startGatewayEventSubscriptionsremains internal; the changedStartcallback type exists only in test support. No compatibility record or SDK type test is required.