Repository navigation
improve: reduce repeated work in multi-agent catalog reads - #149170
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: needs maintainer review before merge. Reviewed September 15, 2026, 2:40 PM ET / 18:40 UTC (Revision 5). ClawSweeper reviewWhat this changesReuse a temporary agent index during bulk model-catalog reads to reduce repeated scans while preserving catalog selection and reload behavior. Merge readiness✅ Ready for maintainer review This remains a useful, focused optimization absent from current main and the latest release. No actionable correctness or security findings remain, and the changed files match the previous reviewed head. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway enriches session listings with model information from already-published agent runtimes. This change shares owner lookup work within one synchronous catalog batch before returning each agent’s catalog. flowchart TD
A[Session listing] --> B[Agent catalog batch]
B --> C[Temporary agent index]
D[Published runtime owners] --> C
C --> E[Existing owner selection checks]
E --> F[Per-agent catalog results]
F --> G[Discard batch index]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +53, Tests +43. Total +96 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep owner indexing inside the existing synchronous read boundary, with unchanged selection predicates and no persistent cache or invalidation machinery. Do we have a high-confidence way to reproduce the issue? Not applicable as a functional bug report; source confirms repeated fallback scans, and the supplied controlled comparison measures that work without claiming a full Gateway benchmark. Is this the best way to solve the issue? Yes. A temporary index in the existing owner removes repeated scans without duplicating selection policy or introducing persistent state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e7dde047904e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
Merged via squash.
|
Why this mattersMulti-agent catalog reads that rebuild owner indexes per agent are a harness scaling tax — and a correctness hazard if a published owner can change while a sync “batch” still holds a temporary index. Operators feel this as wrong-model / wrong-plugin selection under hot reload, not as a micro-optimization miss. EvidenceTip
Gap (agent-fixable):
Decision-changing ask: For this leaf — is mid-batch publish of Review focus:
Architecture (proposal)Failure class: live shared Map + temporary index without a generation / epoch — cache without an invalidation contract in multi-agent prepared-runtime reads. Ask (design, light) — prospective; no need to resolve on this leaf
|
Related: #149057
What Problem This Solves
Reading prepared model catalogs for several configured agents repeatedly scans the same published runtime owners. A batch of N agent reads can visit N² owners even though the published state remains unchanged throughout the synchronous read.
User Impact
Session-list catalog reads do less repeated work as the configured agent count grows. Catalog results, exact-owner selection, ambiguity handling, and reload behavior remain unchanged.
Why This Change Was Made
The runtime owner builds a temporary agent index on the first fallback lookup in a synchronous batch. Subsequent reads reuse those candidate owners while retaining the existing selection predicate. The index is discarded when the batch returns or throws; nested batches restore their parent scope. Exact-key and ordinary scalar reads keep their existing behavior.
The Gateway uses this scope inside its existing lazy catalog boundary. No persistent cache, invalidation hooks, configuration, schema, or public SDK surface is added.
Evidence
This focused four-file change is based on post-catalog main
aff65c00b8b7. All four changed files match the reviewed candidate exactly; the earlier catalog change is already merged. Existing local and clean-install build evidence retains its recorded base qualification. Exact-head hosted CI passed on the current integration below.Historical CI 34982341891 failed one QA native child-bundle case in job 104425947239: the first producer attempt lacks its evidence receipt. The shard passed 994 cases and failed 1; the other three native retry variants passed. The QA test, runner, lifecycle and public API are outside this four-file change and match the same owners involved in #148956. Cause remains unresolved. A subsequent isolated diagnostic on exact
04b911b509b9plus instrumentation passed all 12 original-order cases with no skips. All nine commands settled, with source and installation fingerprints unchanged. The diagnostic brackets the broad API through a dynamic import, so this does not reproduce the original static-import CI failure or establish a fix. The original failed run remains recorded; deadlines and receipt assertions were unchanged. That failed run did not satisfy native landing gates.Previous head
145defe364e0normally integrates repaired main22a07e0abe7f, including canonical #149243. That fixture uses the existing evidence-only API and records the command failure alongside its log without changing the child deadline or assertions. This does not establish the cause of the old intermittent failure. All four original/candidate file pairs and the complete owner patch are byte-identical to the prior reviewed integration. That previous integration awaited exact-head CI; historical proof retains its recorded base and the old failed run remains failed evidence.Historical CI 34996069550 has failed the compact-large-15 and compact-small-28/31/34 tooling jobs. The common main also has native fixture failures after the repository metadata request introduced in #149230. Canonical repair owners investigated them; this run remains failed and no retry or deadline change was made. Exact-head gates remain required before landing.
Current head
7c416f20cf45integrates main273b6c5e11462, containing the merged native fixture repair #149294 and Codex model-attribution fixture repair #149301. Every complete original/candidate file pair and the complete binary PR patch are byte-identical to the preceding reviewed integration. Existing source review remains applicable; prior runtime evidence retains its recorded base. Exact-head CI35006734161 passed on7c416f20cf45; native gates remain required before landing. Historical failures remain recorded; no CI retry or deadline/assertion change was made in this PR.