Skip to content

improve: avoid repeated model indexing in chat metadata - #149389

Merged
steipete merged 2 commits into
mainfrom
codex/metadata-configured-index-20260915
Sep 16, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/metadata-configured-index-20260915

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Opening chats and reading model metadata repeats configured-model indexing for every logical catalog entry.

User Impact

Catalog projection does less repeated work while preserving model availability, configured names and budgets, runtime-specific capabilities, and personal-account authorization freshness.

Why This Change Was Made

Reuse the projection's existing lazy configured-model resolver and pass the selected runtime's donor rows explicitly. The resolver retains its existing projection lifetime and authorization order, including explicit empty donor lists.

Evidence

Tested head: ed5ab23fd0a7e8bd6214773b00591a527966b314. On pinned main dc92446872809320a460ab01e589ddeffaec474d, the regression reproduced five additional visits to each of 17 configured rows for five logical models. The candidate permits at most one, preserves configured names/context windows/prompt budgets, and retains the exact authorization failure without projecting before rejection. All 119 focused and sibling tests, full changed checks, and independent P2 review passed. Exact-head CI passed.

Fresh Blacksmith Testbox proof installed and built that exact source with Node 24.19.0 and pnpm 12.3.4. A real CLI Gateway and device-backed client exercised personal-account connection through users.authConnect, created shared/personal pinned sessions, and completed all 30 recorded RPCs, including 16 alternating chat.metadata calls across 32- and 128-model cohorts. Model IDs, names, context windows, availability, account pins, scopes and build identity matched. Both Gateway children, service units and all state/client lifetimes closed; the export and canonical lease closure were verified independently. Metadata responses took 3.7–23.5 ms at 32 models and 9.5–78.7 ms at 128 models.

The hosting workflow ultimately reported cancelled. Successful application execution, strict export and lease closure are established by their independently verified receipts. The cancellation’s initiating actor is not established.

The earlier component benchmark remains attributed to base 1349c4c5420c1f0853f83ad6e0a35ab9db6b8791 and candidate aa69748df9caca2a408e4f067d9ef8487e0afda7. With three warmups and 12 fresh projectors per process, two interleaved 128-model observations took 0.2801/0.3000 seconds before and 0.2213/0.2212 seconds after; outputs matched. This measured the real constructor and awaited projection, with GC and scheduling uncontrolled.

These are small synthetic samples, not a production-latency, memory-reduction or stall-elimination claim. The historical component baseline is not a matched before/after RPC control. The two earlier queued provisioning attempts produced no product receipts; the fresh Gateway run completes the previously missing remote validation.

@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 15, 2026 20:03
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Sep 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 12:54 AM ET / 04:54 UTC (Revision 6).

ClawSweeper review

What this changes

Reuses configured-model indexes while preparing chat metadata, preserves runtime-specific metadata donors, and adds regression coverage for indexing and authorization failures.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main still repeats configured-model indexing. No actionable patch defects were found, and the updated Gateway evidence resolves the previous review’s remote-validation blocker.

Priority: P2
Reviewed head: ed5ab23fd0a7e8bd6214773b00591a527966b314

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-reuse optimization with meaningful regression coverage and sufficient bounded Gateway proof.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): Captured exact-head Testbox observations exercise the changed projector through real shared/personal chat.metadata RPCs and report preserved model metadata and account pins, resolving the previous remote-validation gap. The hosting cancellation does not negate those separately reported results; raw log retrieval was reviewer-blocked.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): Captured exact-head Testbox observations exercise the changed projector through real shared/personal chat.metadata RPCs and report preserved model metadata and account pins, resolving the previous remote-validation gap. The hosting cancellation does not negate those separately reported results; raw log retrieval was reviewer-blocked.
Evidence reviewed 9 items Introduced change and preserved ordering: The pinned introduced diff reuses the existing view after awaited account evaluation and runtime selection. The override resolver remains local to the projection, and nullish fallback preserves explicitly empty donor arrays.
Existing indexing owner: The configured override resolver maintains provider-local lookup functions; their configured-row index is built lazily. Reusing this owner avoids repeated scans without introducing another cache or changing persistence.
Current main still needs the optimization: Fetched main still creates a new catalog view for each selected logical entry. The merged related CI repair does not change this runtime behavior.
Findings None None.
Security None None.

How this fits together

The Gateway combines configured model settings, catalog snapshots, and account availability to prepare model metadata for chats. This change reduces repeated work within that existing projection.

flowchart TD
  A[Configured model settings] --> D[Lazy configured-model index]
  B[Published catalog snapshot] --> C[Account and runtime evaluation]
  C --> E[Select runtime metadata donors]
  D --> F[Project model metadata]
  E --> F
  F --> G[Chat metadata response]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +1, Tests +109. Total +110 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 8 7 +1
Tests 1 109 0 +109
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 117 7 +110

Review metrics

Metric Value Why it matters
Configured-row traversal 5 additional visits per row reduced to at most 1 The reported regression uses five logical models and 17 configured rows, directly measuring the repeated work this patch removes.

Technical review

Best possible solution:

Keep configured-row indexing within the existing projection owner while preserving runtime donor isolation and live account checks.

Do we have a high-confidence way to reproduce the issue?

Yes: current-main source rebuilds the lazy configured-row resolver inside each logical-model projection, and the supplied regression records repeated visits. This review did not execute tests.

Is this the best way to solve the issue?

Yes: reusing the existing projection owner is a narrow repair that preserves authorization ordering, configured overrides, and explicitly empty runtime donor sets.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9c8e425f0197.

Labels

Label justifications:

  • P2: This is a bounded performance improvement to chat metadata preparation with no demonstrated outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): Captured exact-head Testbox observations exercise the changed projector through real shared/personal chat.metadata RPCs and report preserved model metadata and account pins, resolving the previous remote-validation gap. The hosting cancellation does not negate those separately reported results; raw log retrieval was reviewer-blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient. Captured exact-head Testbox observations exercise the changed projector through real shared/personal chat.metadata RPCs and report preserved model metadata and account pins, resolving the previous remote-validation gap. The hosting cancellation does not negate those separately reported results; raw log retrieval was reviewer-blocked.

Evidence

What I checked:

  • Introduced change and preserved ordering: The pinned introduced diff reuses the existing view after awaited account evaluation and runtime selection. The override resolver remains local to the projection, and nullish fallback preserves explicitly empty donor arrays. (src/gateway/server-methods/models-list-result.ts:125, ed5ab23fd0a7)
  • Existing indexing owner: The configured override resolver maintains provider-local lookup functions; their configured-row index is built lazily. Reusing this owner avoids repeated scans without introducing another cache or changing persistence. (src/agents/model-catalog-route.ts:61, ed5ab23fd0a7)
  • Current main still needs the optimization: Fetched main still creates a new catalog view for each selected logical entry. The merged related CI repair does not change this runtime behavior. (src/gateway/server-methods/models-list-result.ts:125, 9c8e425f0197)
  • Release comparison: The v2026.9.4 source already reused a view before the newer runtime-specific donor selection existed; this does not establish that the current-main repeated-indexing problem is fixed or that this PR is redundant. The release source was read through GitHub after the local blob lookup failed. (src/gateway/server-methods/models-list-result.ts:89, 3a9d69db306c)
  • Focused regression coverage: The added cases exercise five logical models against 17 configured rows, preserve distinct configured names and budgets, retain the exact authorization error, and verify repeated reads reuse the result. Existing sibling cases cover runtime donor isolation. Tests were inspected, not executed during this read-only review. (src/gateway/server-methods/models-list-result.runtime-choices.test.ts:19, ed5ab23fd0a7)
  • Updated real Gateway evidence resolves prior feedback: The captured PR body and improve: avoid repeated model indexing in chat metadata #149389 (comment) record an exact-head Testbox build, a real CLI Gateway and device-backed client, personal-account connection, and 30 successful RPCs including 16 alternating shared/personal chat.metadata calls with 32 and 128 models. Reported outputs preserve identities, names, windows, availability and account pins. This directly addresses the previous review’s sole retained rank-up move. The historical component benchmark remains separately attributed and does not establish production latency or memory savings. (ed5ab23fd0a7)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (5 earlier review cycles)
  • reviewed 2026-09-15T20:15:49.082Z sha aa69748 :: blocked before merge. :: none
  • reviewed 2026-09-15T20:43:43.160Z sha aa69748 :: blocked before merge. :: none
  • reviewed 2026-09-15T21:20:07.832Z sha aa69748 :: blocked before merge. :: none
  • reviewed 2026-09-15T22:34:47.571Z sha 1d6bdf9 :: blocked before merge. :: none
  • reviewed 2026-09-16T03:14:34.915Z sha ed5ab23 :: blocked before merge. :: none

@steipete
steipete force-pushed the codex/metadata-configured-index-20260915 branch from aa69748 to 1d6bdf9 Compare September 15, 2026 21:40
Preserve the configured-index production change while incorporating main at
dc92446. Extend the existing projection regression to verify distinct
configured prompt budgets alongside names and context windows.
@steipete

Copy link
Copy Markdown
Contributor Author

The remote Gateway validation retained by ClawSweeper revision 5 is now complete at ed5ab23fd0a7e8bd6214773b00591a527966b314. A fresh Testbox install/build completed 30 successful RPCs, including 16 alternating shared/personal chat.metadata calls at 32 and 128 configured models. Responses, account pins, scopes/build identity, cleanup and strict export were independently verified, and the lease is closed. The updated PR body records the evidence and its synthetic-workload limits; no component-only waiver is needed.

The hosting workflow reported cancelled. Successful application execution, strict export and lease closure were verified separately; the cancellation's initiating actor is not established.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 16, 2026
@steipete
steipete merged commit c912196 into main Sep 16, 2026
197 checks passed
@steipete
steipete deleted the codex/metadata-configured-index-20260915 branch September 16, 2026 05:17
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant