Repository navigation
improve: copy only the selected model for agent completions - #206287
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: passed. What this changesThis PR enables selected-row model-store creation for built-in agent completion resolution while preserving full stores for custom resolvers. Example: Acquire selected-completion/entry from the three-row alias fixture, which selects middle.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR makes a focused performance improvement still absent from main, with no concrete correctness or security findings. Reviewed head: Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherAgent completion acquisition captures a runtime generation, resolves the selected model and credentials, and returns an executable model whose lease lasts through completion. flowchart LR
A[Completion caller] --> B[Agent acquisition]
B --> C[Prepared runtime generation]
C --> D[Resolver context]
D --> E[Built-in selected-row stores]
D --> F[Custom resolver full stores]
E --> G[Prepared completion]
F --> G
Technical reviewBest possible solution: Keep the existing selected-row mechanism enabled at acquisition, preserving custom resolver stores and lazy catalog expansion. Do we have a high-confidence way to reproduce the issue? Source establishes that main eagerly creates full stores before built-in acquisition resolution; no target code was executed during this read-only review. Is this the best way to solve the issue? The one-line production change reuses the existing optimization at the missing entry point and leaves credential, routing, catalog expansion, and lease ownership with their current owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5b6cc381e1d0. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests +7. Total +8 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 26, 2026, 9:33 PM ET / November 27, 2026, 02:33 UTC. |
|
Merged via squash.
|
* commit '7df6cb759f9e604921536a700e2f527c5516e7de': (185 commits) docs: clarify what telemetry OpenClaw sends and how to opt out refactor(ui): remove retired stream-follow test seams (#206316) fix: distinguish missing command results from unknown outcomes (#206313) fix(build): reuse stamps after identical pnpm installs (#206282) chore(ci): inventory Gateway model catalog worker lifecycles (#206251) fix: keep failed image inspections inside chat activity (#206283) fix: clarify sent-message labels and chat activity icons (#206048) fix(cron): use the service's free memory for extra automation runs (#206322) test(android): reuse the shared TLS fixture (#206280) fix(ui): restore New Session recovery during startup (#206319) test(macos): align new Gateway URL expectations (#206281) feat: let doctor --fix tell when its startup repairs have nothing to do (#206246) fix(android): pause idle gateway discovery without blocking consumers (#196209) fix(ci): prepare the Android SDK for scheduled CodeQL scans (#203843) fix(memory): read delegated cgroup pressure from the mapped leaf (#206308) improve(config): reuse plugin metadata during auto-enable (#206289) improve: copy only the selected model for agent completions (#206287) fix(pr): refresh tooling before preparing reviewed incoming PRs (#206236) fix: keep Gateway ready while plugins drain after updates (#206299) fix(crabbox): keep unused prepared mirrors reusable (#206267) ...
What Problem This Solves
An agent-scoped simple completion selects a provider and model, then deep-copies every model in the prepared catalog before resolving that one selection. Local model commands and other callers of the same helper pay this cost on each acquisition.
User Impact
The built-in resolver can start with the selected catalog row. A provider that needs a sibling model or enumerates the catalog still receives its captured inventory. Custom resolvers keep the full, mutable request-local registry and credential store they receive today.
Why This Change Was Made
Prepared simple completions already let the built-in resolver open its model stores after normalizing the selection. The agent acquisition path now uses the same option. Credential selection, route materialization and the lifetime of the acquired model still have their existing owners.
Evidence
infer model runaction and recorded its loopback replies and timing. The registry copy counts above came from the separate instrumented catalog probe. The device run kept the same timing observer in both versions, so it produced no per-row copy log.