-
-
Notifications
You must be signed in to change notification settings - Fork 69.3k
openclaw agent --json output polluted by plugin loading logs #51076
Copy link
Copy link
Open
Description
Description
When running openclaw agent --agent <id> --json, plugin loading messages are printed to stdout, corrupting the JSON output that downstream consumers expect.
Steps to Reproduce
- Install a plugin that logs during load (e.g. memory-lancedb-pro)
- Run:
openclaw agent --agent some-agent --message "hello" --json --timeout 60 - Observe stdout
Expected Behavior
Stdout contains only valid JSON (the agent result). All log messages (plugin loading, warnings, etc.) should go to stderr.
Actual Behavior
Stdout contains plugin loading messages mixed with JSON:
[plugins] memory-lancedb-pro: smart extraction enabled (LLM model: qwen3.5-plus, noise bank: ON)
[plugins] [email protected]: plugin registered (db: /Users/user/.openclaw/memory/lancedb-pro, model: jina-embeddings-v5-text-small, smartExtraction: ON)
[plugins] memory-lancedb-pro: diagnostic build tag loaded (memory-lancedb-pro-diag-20260308-0058)
[plugins] session-strategy: using none (plugin memory-reflection hooks disabled)
[plugins] girlfriend-control: loaded without install/load-path provenance; treat as untracked local code and pin trust via plugins.allow or install records (/path/to/index.ts)
[plugins] memory-lancedb-pro: loaded without install/load-path provenance; treat as untracked local code and pin trust via plugins.allow or install records (/path/to/index.ts)
{"runId":"...","status":"ok","result":{...}}
This breaks any programmatic consumer that parses result.stdout as JSON (e.g. json.loads(result.stdout) in Python).
Impact
- Any backend/frontend that calls
openclaw agent --jsonvia subprocess and parses stdout will intermittently fail with JSON parse errors - The issue is intermittent because sometimes the JSON appears after the logs (parse succeeds), and sometimes stdout only contains logs (parse fails with
Expecting value: line 1 column 1 (char 0))
Suggested Fix
When --json flag is set, route all non-JSON log output (plugin loading messages, warnings, etc.) to stderr instead of stdout. Only the final JSON result should go to stdout.
Environment
- OpenClaw version: 2026.3.13 (61d171a)
- OS: macOS 15.7.3 (Sequoia) / arm64
- Plugin: [email protected]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.