Repository navigation
perf(session-share): keep remote refreshes off catalog RPCs - #165887
Conversation
Serve catalog searches and pages from bounded service-owned node snapshots. Keep refresh admission, concurrency, expiry, retry, and cancellation with the Session Share service while transcript reads retain live source checks. Honor completed host errors and late publications in Gateway fallback pages so expired or withdrawn snapshots cannot be replaced by older cached rows.
|
🦞👀 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 October 5, 2026, 8:52 PM ET / October 6, 2026, 00:52 UTC. ClawSweeper reviewWhat this changesSession Share serves catalog searches and pages from bounded background-refreshed snapshots, while the Gateway preserves completed host errors and withdrawals. Merge readiness✅ Ready for maintainer review This remains a useful performance repair: pinned main and the latest release retain the foreground refresh path. No blocking introduced defect was found. Priority: P2 Review scores
Verification
How this fits togetherSession Share exposes selected sessions from paired source nodes in the receiver Gateway's session catalog. The receiver turns source listings into searchable pages, while transcript reads still check sharing permissions on the source. flowchart TD
A[Catalog request] --> B[Receiver snapshot owner]
C[Paired source node] --> D[Bounded background refresh]
D --> B
B --> E{Snapshot available and fresh?}
E -->|Yes| F[Local search and pagination]
E -->|No| G[Loading or unavailable host]
F --> H[Gateway viewer permission checks]
G --> H
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +145, Tests +149, Docs +5. Total +299 across 8 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep remote refresh ownership in the Session Share service and preserve explicit loading, bounded freshness, authoritative withdrawals, and live transcript authorization. Do we have a high-confidence way to reproduce the issue? Yes, from source: a slow paired node keeps the old provider awaiting remote completion and forces the Gateway's one-second budget path. The captured before/after harness measurements support this mechanism; this review did not execute it. Is this the best way to solve the issue? Yes. One service-owned complete snapshot supports local search and pagination while the Gateway honors host withdrawals, avoiding competing refresh owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 90c6934d630f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…#165887) * perf(session-share): keep remote refreshes off catalog RPCs Serve catalog searches and pages from bounded service-owned node snapshots. Keep refresh admission, concurrency, expiry, retry, and cancellation with the Session Share service while transcript reads retain live source checks. Honor completed host errors and late publications in Gateway fallback pages so expired or withdrawn snapshots cannot be replaced by older cached rows. * test(session-share): preserve catalog diagnostic guarantees
What Problem This Solves
A slow or unreachable paired Session Share node delays
sessions.catalog.list, including repeated requests for an unchanged listing. The old provider invokes the node after every completed request, and the Gateway waits up to one second before returning partial or stale results.User Impact
Catalog listing, search, and pagination return immediately from a receiver-owned snapshot. Cold callers receive an explicit loading host and progressive callers receive the completed snapshot later. Expired or disconnected hosts return no rows. Transcript reads retain the source's live sharing-permission check.
The receiver refreshes every 30 seconds after completion, backs failures off from 30 seconds to five minutes, and stops serving a snapshot after 60 seconds. Configuration changes, observed disconnect/reconnect, and service retirement invalidate it. The documented SDK has no remote share-change subscription; source changes arrive on the next successful bounded refresh. No configuration, protocol, dependency, or stored-state migration is needed.
Why This Change Was Made
The plugin service scheduler now owns one complete snapshot per admitted node/configuration/connection incarnation, cancellation, retries, and shutdown joining. Only requested hosts are admitted, with at most 32 retained snapshots and four concurrent refresh workers. Each refresh has a five-minute total pagination budget and a 30-second per-invocation limit. Complete snapshots are bounded to 10,000 rows / 16 MiB; oversized listings fail explicitly with guidance to reduce shared groups, without publishing a truncated catalog. Search and pagination are local projections.
The Gateway respects completed host errors and withdrawals even alongside pending siblings. Its stale fallback can no longer resurrect rows after the provider expires or withdraws them. Existing catalog progress continues to recheck the viewer's permissions.
Production LOC is +145 across two files (
git diff --stat origin/main...HEAD -- ':!*.test.ts' ':!*test-support*' ':!docs/*'). The growth implements the required complete local search/pagination contract, joined service lifetime, and bounded node admission, concurrency, memory, expiry, and retry behavior. It replaces the old query-page cache, foreground timeout, and follower path; there is one refresh owner.Evidence
openclaw.sessions.list.v1, has a 30-second timeout, and returns at most 100 rows / 2 MiB per wire page.sessions.catalog.listhandler regression fails on the old provider: none of six callers completes within 49 ms for a five-second success or a thirty-second failure. The existing simulated-clock measurement falls from 1,000 ms to 0 ms, matching the no-plugin baseline. Warm calls issue no additional invokes. Slow invocation logging belongs only to background refresh and is rate-limited to once per minute.nice -n 10 ionice -c3 bash /srv/rig/lane524-wall-benchmark.sh, runningpnpm test src/gateway/server-methods/session-catalog.session-share.test.ts --maxWorkers=1with the same temporary benchmark before/after; exit 0. Test-body wall times were 101.33 seconds before / 0.75 seconds after; temporary source replacements were restored.blacksmith-testbox, profileopenclaw-check, leasetbx_01m478694rgv1ty2q3qv9h1ngm:pnpm test extensions/session-share/src/session-catalog.test.ts src/gateway/server-methods/session-catalog.session-share.test.ts src/gateway/server-methods/session-catalog-budget.test.ts src/gateway/server-methods/session-catalog-progress.test.ts test/plugins/session-share.integration.test.ts --maxWorkers=1passed 73/73 (receiver 30, Gateway 32, paired integration 11). Wrapper wall time 80.58 seconds (receiver 15.80 s, Gateway 27.41 s, paired integration 33.70 s); remote command including one frozen dependency install 96.2 seconds, exit 0. An initial preflight stopped before testing because native sync keeps the base Git HEAD and overlays candidate files; the corrected preflight verified the base plus exact candidate hashes. Hosted CI run 37395792641 passed on exact head451ffe5c16543b05caf6194dbf3ab1eea3a54fcf: 404 seconds elapsed, 5,199 summed job-seconds across the full run (not incremental test cost), with no failed jobs or reruns. ClawSweeper also reported no actionable findings on that head.blacksmith-testbox, profileopenclaw-check, leasestbx_01m470v2cmnw5ks60gmc46djthandtbx_01m474qwavhycee0c8v763zj00. Full staged attempts passed all typecheck partitions, guards, and core lint, then exposed extension lint findings that were fixed. The final owner check passed:node scripts/check-changed.mjs --base HEAD -- extensions/session-share/src/session-catalog.ts extensions/session-share/src/session-catalog.test.ts docs/plugins/session-share.md. The last command, including focused tests and the cancellation negative control, exited 0 in 355.2 seconds. Unaffected successful checks were reused; this is not a claim that one monolithic full staged command passed.nohup bash /srv/rig/rig-staged-check.sh lane524 b78db8b8f258on the reviewed feature commit plus staged diagnostics patch.node scripts/check-changed.mjs --stagedpassed, exit 0 (00:21–00:40 UTC): formatting, extension test types, plugin boundaries, dependency/compatibility guards, all three dead-export scans, and extension lint (zero warnings/errors). Both the feature review and diagnostics-only review finished scoped-clean, P0–P2. No required check was waived.Measurements use the real handler and plugin with controlled transport in the paired/mock harness; they are not two deployed Gateways or production network latency. No production Gateway was modified. The Codex producer warning is a separate follow-up: its owner already has an event-fed resident index and background refresh, and the inclusive warning includes asynchronous control-request wait, so it does not establish main-thread CPU time.