Repository navigation
fix(cli): reduce startup delay for model inference probes - #169354
Conversation
Keep case-correction catalog loading inside the existing lazy catalog callback. Ordinary model runs no longer import that runtime solely to construct an unused callback. Related: #88201.
|
🦞👀 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. What this changesThis PR defers model-catalog imports until an explicit mixed-case model override needs case correction. Example: Run
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep open: this PR provides a focused, useful startup optimization that current main still lacks, with no actionable correctness or security findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe inference CLI resolves agent configuration and model overrides, then sends the supplied prompt through local completion or Gateway inference and emits a result envelope. flowchart TD
A[Inference CLI] --> B[Resolve config and agent]
B --> C[Canonicalize model override]
C -->|Mixed case| D[Lazy catalog inspection]
D --> E[Local or Gateway inference]
C -->|Default or lowercase| E
E --> F[Result envelope]
Technical reviewBest possible solution: Land the focused lazy-import optimization and retain the broader latency report for separately measured remaining bottlenecks. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the unused eager import for default and lowercase model runs, supported by the supplied native CLI measurements; this review performed no runtime reproduction. Is this the best way to solve the issue? Reusing the existing lazy catalog loader fixes the import boundary directly while preserving agent selection, read-only catalog acquisition, authentication, and completion handling. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against aef528ff45ef. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -1, Tests +5, Docs +1. Total +5 across 3 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
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 HistoryReview history (1 earlier review cycle)
Reviewed October 11, 2026, 5:22 PM ET / 21:22 UTC (Revision 2). |
|
Merged via squash.
|
…69354) Keep case-correction catalog loading inside the existing lazy catalog callback. Ordinary model runs no longer import that runtime solely to construct an unused callback. Related: openclaw#88201.
Related: #88201. Thanks @adamdksaad-ops for the latency report.
What Problem This Solves
infer model runeagerly imports the prepared-model catalog even when the user selects the configured default or a lowercase provider/model ref, delaying the request before inference starts.User Impact
Ordinary probes skip this unused catalog import. Case correction, agent selection, auth, and completion outcomes remain unchanged. This removes one avoidable startup cost; substantial local CLI startup overhead remains.
Why This Change Was Made
The model-ref owner already calls its catalog callback only when case correction needs it. Reuse the existing lazy inspection loader inside that callback instead of importing its execution graph up front. Production: +1/-2 lines (net -1); tests: +5/-0; docs: +1/-0.
Evidence
Real native Ollama
llama3.2:latest, warm model, isolated state and Gateway on port 19564; promptHi, respond with just OK. Every successful call returnedOK. Commands usedpnpm openclaw --profile triage-a infer model run --local|--gateway --prompt 'Hi, respond with just OK' --json./api/chat: 0.083–0.113 s warm; initial cold load 4.065 s.d220cac2b74433fdb189ac381b9fca2bfcaf7e07: local 12.06 s first / 8.28 s warm (profiled 8.97 s); Gateway 15.94 s first / 10.50 s profiled warm.node scripts/run-vitest.mjs src/cli/capability-cli/model.run-outcomes.test.ts src/cli/capability-cli.test.ts --maxWorkers=1, 47.23 s wall (38.25 s Vitest including cold compilation, about 13.8 s test execution). No new test cases, timers, or process boots; zero additional CI test invocations.pnpm build, focused oxlint,pnpm tsgo:core, formatting, docs MDX, andgit diff --checkpass. Assertion-safety, max-lines, line-cap, test-timeout-race, test-mock-exports, config-docs, and plugin-inventory ratchets pass.SIGILL; the affected checks were run directly. Gateway-only setup omitted the pinned lint workspace dependency; installing that workspace made lint pass.openclaw/ci-gateis green on860b91f33c9b0d9fb05488a354e3bdffa80de1aa.