fix: trace plugin tool factory timings (#75823)

* fix: trace plugin tool factory timings

* docs: document plugin tool timing traces

* fix: keep plugin tools mcp stdout clean

* test: type plugin tools mcp mock

* test: complete plugin tools mcp mock

* test: preserve console helpers in mcp test

* chore: refresh generated protocol models
This commit is contained in:
Peter Steinberger
2026-05-01 23:14:18 +01:00
committed by GitHub
parent 667371dd51
commit 0df90d9b8d
8 changed files with 357 additions and 2 deletions

View File

@@ -41,6 +41,9 @@ openclaw logs --follow
raise the file log level.
- To capture verbose-only details in file logs, set `logging.level` to `debug` or
`trace`.
- Trace logging also includes diagnostic timing summaries for selected hot paths,
such as plugin tool factory preparation. See
[/tools/plugin#slow-plugin-tool-setup](/tools/plugin#slow-plugin-tool-setup).
## Console capture

View File

@@ -334,6 +334,37 @@ do not run in live chat traffic, check these first:
Gateway session/status surfaces and, when debugging provider payloads, start
the Gateway with `--raw-stream --raw-stream-path <path>`.
### Slow plugin tool setup
If agent turns appear to stall while preparing tools, enable trace logging and
check for plugin tool factory timing lines:
```bash
openclaw config set logging.level trace
openclaw logs --follow
```
Look for:
```text
[trace:plugin-tools] factory timings ...
```
The summary lists total factory time and the slowest plugin tool factories,
including plugin id, declared tool names, result shape, and whether the tool is
optional. Slow lines are promoted to warnings when a single factory takes at
least 1s or total plugin tool factory prep takes at least 5s.
If one plugin dominates the timing, inspect its runtime registrations:
```bash
openclaw plugins inspect <plugin-id> --runtime --json
```
Then update, reinstall, or disable that plugin. Plugin authors should move
expensive dependency loading behind the tool execution path instead of doing it
inside the tool factory.
### Duplicate channel or tool ownership
Symptoms: