Repository navigation
perf(gateway): reuse session catalog entry snapshots per request - #114358
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 2:08 AM ET / 06:08 UTC. ClawSweeper reviewWhat this changesThe branch creates a lazy per-request snapshot of persisted session entries and passes it through gateway, Codex, and Anthropic catalog providers so one catalog request does not repeatedly enumerate the same agent stores. Merge readiness⛔ Blocked until real behavior proof is added - 6 items remain This PR addresses a real catalog-listing cost, but it is not ready to merge. It extends the public session-catalog plugin contract without visible owner approval and still lacks inspectable after-fix runtime proof; the existing protected Priority: P3 Review scores
Verification
How this fits togetherThe gateway handles flowchart LR
Client[Control UI catalog request] --> Gateway[Gateway catalog handler]
Gateway --> Snapshot[Request-local session-entry snapshot]
Gateway --> Providers[Registered catalog providers]
Snapshot --> Codex[Codex catalog provider]
Snapshot --> Anthropic[Anthropic catalog provider]
Codex --> Result[Catalog hosts and sessions]
Anthropic --> Result
Result --> Client
Decision needed
Why: The patch adds a reusable public plugin API surface rather than only changing gateway internals; repository policy requires maintainer-visible direction for plugin SDK additions. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +95, Tests +103. Total +198 across 9 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the optimization request-scoped, obtain an explicit owner decision on the public plugin-SDK shape, and attach redacted after-fix runtime evidence that compares the catalog request’s store-listing behavior before and after the change. Do we have a high-confidence way to reproduce the issue? No high-confidence live reproduction is included in the review material. Source inspection of the proposed path supports the repeated-read mechanism, but the claimed production latency reduction needs after-fix runtime evidence. Is this the best way to solve the issue? Unclear: a request-local snapshot matches the repository’s prepared-facts guidance, but exposing it through the public plugin SDK is not yet established as the best boundary; a narrower injected runtime seam may avoid a permanent provider contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ffec7731a4ac. 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
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…nclaw#114358) * perf(gateway): reuse session catalog entry snapshots * chore(gateway): satisfy knip and typed-test lanes for catalog snapshot
What Problem This Solves
sessions.catalog.list— the sidebar CODING/catalog surface — averaged 620ms (max 1829ms) on team.openclaw.ai. Profile attribution shows the catalog path re-listing and JSON-parsing entire session stores multiple times inside one request: helper scans (Claude 1, Codex local 1, Codex nodes 1) plus one gateway re-list per unique adopted session key. With ~180 sessions per store, one request repeated the same SQLite enumeration andentry_jsonparse H+U times.Why This Change Was Made
One lazily built, request-scoped session-entry snapshot per touched agent/store (
session-catalog-entry-snapshot.ts), shared across all catalogs, hosts, helpers, progressive frames, and the final projection. This is intra-request "carry prepared facts forward" — deliberately not a cross-request cache, since session entries are not process-stable. Callers without a snapshot keep the runtime fallback. Ordering and response shape unchanged; plugin discovery files untouched (that half landed separately in #114324).User Impact
Catalog listing cost stops scaling with (stores × helpers × adopted sessions); the sidebar coding section loads with one store enumeration per agent. Gains grow with store size and adopted-session count.
Evidence
parseSqliteSessionEntryJson via listSqliteSessionEntriesFromDatabase <- resolveSqliteScopeinside the catalog path).git diff --checkclean; no CHANGELOG edits; all new exports multi-consumer (knip-safe).gpt-5.6-sol, xhigh): clean, "patch is correct (0.86)".