Repository navigation
perf(gateway): share one node.list snapshot across session catalog providers - #114646
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 1:05 PM ET / 17:05 UTC. ClawSweeper reviewWhat this changesThis PR lets selected session-catalog providers share one lazy Gateway Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 5 items remain Keep this PR open for maintainer review. The request-scoped lazy snapshot is a coherent extension of the recently merged session-entry snapshot pattern, but the new optional catalog-provider SDK parameter needs explicit contract approval and the submitted evidence does not show an after-fix live catalog request or measured improvement. Priority: P3 Review scores
Verification
How this fits togetherThe Gateway’s flowchart LR
Request[Catalog request] --> Gateway[Gateway catalog handler]
Gateway --> Snapshot[Lazy request node snapshot]
Gateway --> Providers[Selected catalog providers]
Snapshot --> Providers
Providers --> Hosts[Session catalog hosts]
Hosts --> Response[Catalog response]
Decision needed
Why: The patch is additive and preserves fallback behavior, but it introduces a new provider-list API that external plugins could adopt; that permanent boundary requires maintainer intent rather than an inferred implementation choice. Before merge
Agent review detailsSecurityNone. PR surfaceSource +24, Tests +120. Total +144 across 11 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the snapshot request-scoped and lazy, document and approve the optional provider callback as the intended plugin contract, then add redacted after-fix live Gateway evidence showing the shared dispatch and performance effect. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: the added Gateway test models multiple selected providers invoking the supplied callback and verifies a single node-list dispatch. The submitted context does not provide an independently observed live after-fix run. Is this the best way to solve the issue? Unclear: request-scoped lazy sharing matches the merged session-entry snapshot pattern and preserves provider fallbacks, but maintainers must first confirm that exposing this as a catalog-provider SDK parameter is the best permanent boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f0a963a2cb52. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
sessions.catalog.liston team.openclaw.ai is the top remaining Control UI cost after the recent perf fleet: 962 calls averaging 567ms in 5h, with 837 of them inside a uniform 200-600ms band — and single-catalog probes cost ~450ms for every provider, including ones whose data sources are absent on the box. That uniformity is a fixed shared cost, not data weight: every catalog provider (Claude, Codex, OpenCode, Pi) independently dispatchesnode.listper request, and each dispatch materializes both device-pairing SQLite tables twice (4 full scans), so an unfiltered request pays ~16 table scans before any session data is read.Why This Change Was Made
The catalog request already carries a request-owned
sessionEntriessnapshot (#114358); this extends the same pattern to nodes. The gateway resolvesnode.listlazily, at most once per catalog request, and shares the promise with every provider via a new optionallistNodesfield on the provider query (additive plugin-SDK surface, doc-commented; providers without it keep theruntime.nodes.list()fallback, so external SDK consumers are unaffected). Providers that never touch nodes trigger zero dispatches — laziness is part of the contract and regression-tested.User Impact
Unfiltered catalog listings drop from ~16 pairing-table scans to 4; sidebar catalog refreshes stop multiplying node-registry work by provider count. No response-shape change; SDK change is additive-optional.
Evidence
sessions.catalog.listat 440-527ms uniformly, including empty providers (journal excerpts in fix(gateway): stop fabricating assistant agent id "main" before roster resolution #114257 (comment) thread context)node.listdispatch; a filtered provider that ignores nodes → zero dispatches (src/gateway/server-methods/session-catalog.test.ts)pnpm plugin-sdk:surface:checkunchanged (316 entrypoints / 7,456 exports); tsgo, knip, oxfmt, oxlint green; autoreview (Codex gpt-5.6-sol, xhigh) cleanFollow-up (separate PR):
node.list's own handler still materializes both pairing tables twice per dispatch (src/gateway/server-methods/nodes.read.ts:213, src/infra/device-pairing-store.ts:247) — the remaining ~single-dispatch floor.