Repository navigation
fix(gateway): reduce CPU work in session lists and searches - #148713
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. |
|
Codex review: blocked before merge. Reviewed September 14, 2026, 11:36 PM ET / September 15, 2026, 03:36 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR reuses prepared plugin metadata when listing and searching sessions, preserves public resolver inputs, and reduces allocation during incognito-key classification. Merge readiness⛔ Blocked before merge - 2 items remain This remains a useful optimization beyond current main. No blocking code defect was found, and the protected maintainer label excludes automatic closure. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway converts stored sessions and agent-scoped model catalogs into searchable summaries for clients. Plugin metadata supplies model aliases and runtime classification during that projection. flowchart TD
A[Session list or search request] --> B[Gateway session reader]
C[Stored sessions] --> B
D[Prepared agent catalog and metadata] --> E[Cache generation check]
B --> E
E --> F[Filter and project rows]
D --> F
F --> G[Session summaries for clients]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +128, Tests +220. Total +348 across 22 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep session projections bound to the existing agent catalog owner's metadata generation, preserving current enablement checks, public inputs, and generation-based invalidation. Do we have a high-confidence way to reproduce the issue? Yes, source inspection traces repeated metadata resolution through session-row runtime classification and unmatched searches; the scaling regression targets that path. Runtime reproduction was not performed during this review. Is this the best way to solve the issue? Yes, passing existing prepared facts through the projection avoids another discovery cache and retains the public SDK contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1528bc1614de. LabelsLabel 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.
|
…#148713) * perf(gateway): reuse prepared metadata in session lists * fix(gateway): keep prepared catalog metadata private
* commit 'd8e50a38fd1c4df6dd69bcbc155697c464e1be45': (23 commits) fix(cron): release queued reservations when activation fails (#141008) fix(gateway): reduce CPU work in session lists and searches (#148713) feat(gateway): add admin CPU profile diagnostics (#148004) fix(gateway): cap device-required probe cache to prevent unbounded growth (#147708) fix(ci): align Gateway E2E expectations (#148653) refactor(ai): remove unused overflow wrapper (#148719) feat: stage selected chat text as editable comments (#148649) fix(ci): admit reachable release refs with large histories (#148161) fix(agents): allow authorized email CLI actions (#148521) improve(agents): trim large tool results with less CPU (#148718) refactor(docker): share image version parsing (#148243) fix(ci): retain passing hosted checks after skipped duplicates (#148722) fix(update): report configuration failures during repair (#144819) refactor(imessage): share handle classification (#148229) fix(ui): keep the selected agent across Settings pages (#148667) test(telegram): reuse deferred fixture helper (#148501) fix(media): resize images before understanding (#122431) fix: preserve unfinished work during completed PR cleanup (#148704) refactor(migrate-hermes): reuse canonical config record coercion (#148645) perf(channels): reduce history worker metadata footprint (#148711) ...
What Problem This Solves
Large session lists and searches repeatedly resolve the same plugin metadata for individual rows, adding avoidable CPU work before results can be returned.
User Impact
Session listing and model search spend less CPU time projecting rows while preserving model aliases, runtime selection, plugin enablement, and incognito classification.
Why This Change Was Made
Carry the existing agent-scoped catalog owner's prepared metadata through runtime classification and model-reference normalization. The catalog projector privately associates captured facts with each returned view, preserving its public fields. Completed list-cache invalidation follows that metadata owner's identity, and current plugin enablement still gets checked. The incognito classifier also avoids splitting and rebuilding each candidate key.
The existing public resolver parameter contracts stay at their original owners; prepared internal callers use the same normalization implementation through explicit Core entrypoints. SDK exports and import topology remain unchanged.
Evidence
The original runtime-metadata path performed 260 current-metadata lookups for 128 rows in both listing and unmatched search. Regression coverage now checks bounded lookup work for rows with and without recorded model identities, successful search through prepared model aliases, metadata-owner replacement, and preservation of the public SDK input boundary.
Final validation: 318 focused list, cache, catalog, and SDK cases, the full build, and all selected changed checks passed. A compiled-helper probe verifies that the producer and consumers share the same private association module. Independent managed review found no actionable P0–P2 issues. Runtime proof uses synthetic session stores.