Repository navigation
perf(llm-task): load task runtime on first execution - #157233
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 24, 2026, 11:09 AM ET / 15:09 UTC (Revision 4). ClawSweeper reviewWhat this changesThe LLM Task plugin registers its tool from static metadata, loads execution code on the first call, and adds an entry-point regression test. Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this improvement is absent from current main, and the code review found no blocking defect. The required installed-upgrade verification remains incomplete. Priority: P2 Review scores
Verification
How this fits togetherLLM Task is an optional plugin tool for structured, JSON-only model calls. Plugin loading supplies tool metadata to OpenClaw; invoking the tool then reaches the model completion runtime and returns validated JSON. flowchart LR
A[Plugin loading] --> B[Static tool metadata]
B --> C[Tool registration]
C --> D[First tool call]
D --> E[Load execution runtime]
E --> F[Model completion]
F --> G[Validated JSON result]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +16, Tests +108. Total +124 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Qualify the candidate through the published updater on an existing installation, including a successful first LLM Task invocation, before landing the lazy-loading improvement. Do we have a high-confidence way to reproduce the issue? Yes. Current main visibly imports the runtime at plugin load, and the captured PR evidence describes paired cold-import measurements; I did not run the benchmark in this read-only review. Is this the best way to solve the issue? Yes. Splitting static metadata from execution uses an existing SDK helper and preserves the plugin contract in source; installed-upgrade behavior still needs qualification. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 440ec7d538f5. LabelsLabel changes: No label changes. Label 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 (3 earlier review cycles)
|
|
Merged via squash.
|
What Problem This Solves
LLM Task loads its execution runtime when the plugin is imported, although registration only needs the tool's static definition.
User Impact
Keep tool registration synchronous and defer the execution runtime until the first invocation. Tool metadata, arguments, configuration reads, results, and errors retain their existing behavior. Three paired cold-import runs showed lower CPU use and peak RSS for the plugin entry.
Why This Change Was Made
Separate the unchanged static tool definition from execution and use the existing lazy-tool helper. Concurrent first use shares loading while each registration retains its API-bound tool.
Production: +49/-33 lines, net +16 for the static-definition/execution boundary. Tests: +108 lines. Total: 190 changed lines across four files.
Evidence
Validated signed source
f48195c08fc94e647fc742f4b6b623e59206935aagainst frozen base88d8a4c20e1387f08d59e62e2d26513650973868:pnpm test extensions/llm-task/index.test.ts --maxWorkers=1passed on Linux x64 / Node 24.19.0. Vitest reported 16.74 s for the file and 16.045 s for its single case; the repository wrapper reported 18.20 s wall time, and the outer proof stage recorded 19 s at whole-second resolution. This observed run includes native worker preparation; it is not a steady-state or incremental CI-cost estimate.git diff --check, and independent source review passed.OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build sourcePerformancepassed and emitted the canonical LLM Task entry. A subsequent full canonical package build passed, including declarations, the tarball checker, and import-graph checks. All four package stages exited successfully; the latest package phase took 1,310 s. Signed source, runtime, and the five recorded dependency-metadata files remained unchanged. The package used a synthetic carrier with the same source tree. This was package validation, with no release or deployment.prompt requiredvalidation error confirmed that execution reached the runtime. This probe did not execute a provider request.prompt requiredvalidation error. This proves installed first-use reachability; it does not claim a valid-prompt provider completion. Install, target preview, update, callback, and cell all exited 0. Source, runtime, five dependency-metadata files, and candidate tarball remained unchanged; fixture and exact worker closure were verified. The expected non-default-HOME service-management warning was retained.Three paired fresh-process imports of the canonical built entry, on the same Linux x64 worker with Node 24.19.0 and alternating baseline/candidate order:
Paired candidate-minus-baseline CPU: median -1,250.505 ms, range -1,306.352 to -1,207.736 ms. Peak RSS: median -229.547 MiB, range -230.535 to -224.555 MiB. Paired medians are calculated from each repetition, rather than subtracting the two medians above.
All six raw reports passed source/build/runtime, CPU/RSS arithmetic, child-process, and temporary-HOME cleanup checks; the worker was closed. These results cover cold import only. They do not measure provider execution, activation/workload cost, retained memory, or leaks. Source dependency inputs and runtime were matched; full installed dependency closure was not attested.