openclaw - 💡(How to fix) Fix Plugin runtime: prependSystemContext via before_prompt_build causes occasional empty model outputs [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#70868Fetched 2026-04-24 10:38:35
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
commented ×1cross-referenced ×1

Fix Action

Fix / Workaround

Workaround: Disable the plugin entirely. No config-level mitigation exists.

RAW_BUFFERClick to expand / collapse

Bug Report

Severity: High — causes silent session corruption

Summary: Using prependSystemContext via the before_prompt_build hook causes occasional empty model outputs (stop=stop, content=[]). The issue was reproduced twice in the same day after the hook was enabled.

Affected versions: Confirmed on current production build (Apr 2026)

Reproduction:

  1. Create a plugin that uses the before_prompt_build hook to set prependSystemContext
  2. Run any prompt (tested with both anthropic/claude-haiku-4-5 and anthropic/claude-sonnet-4-6)
  3. Approximately 1 in 5–10 runs returns stop_reason=stop with empty content=[]

Key detail: This is NOT a payload size issue. Tested with a minimal 220-character injection and still reproduced. The issue is an architectural interaction between the plugin hook and the model runtime pipeline.

Evidence:

  • Session f8ee6b28 at approximately 19:07 CDT and 18:05 CDT on 2026-04-23
  • Both haiku-4-5 and sonnet-4-6 affected
  • Manifest in gateway.err.log as: incomplete turn detected: ... stopReason=stop payloads=0

Impact: When empty outputs occur, OpenClaw writes them into the session transcript, seeding LCM with structurally malformed entries. Combined with delivery-mirror (see related bug), this creates a corruption chain that renders the session unrecoverable without /new.

Workaround: Disable the plugin entirely. No config-level mitigation exists.

Request: Fix the root interaction between prependSystemContext and the model runtime, or provide a safe pre-prompt injection path that doesn't trigger empty outputs.

extent analysis

TL;DR

Disabling the plugin that uses the before_prompt_build hook to set prependSystemContext is the most straightforward workaround to prevent silent session corruption.

Guidance

  • Investigate the interaction between the prependSystemContext hook and the model runtime pipeline to identify the root cause of the empty model outputs.
  • Review the plugin code to ensure that the prependSystemContext is being set correctly and not interfering with the model's output generation.
  • Test the plugin with different models and prompts to determine if the issue is specific to certain configurations.
  • Consider implementing a temporary fix to detect and handle empty outputs, preventing them from being written to the session transcript and causing further corruption.

Example

No code snippet is provided as the issue does not include specific code details, and generating code without clear context may introduce inaccuracies.

Notes

The provided workaround of disabling the plugin entirely may not be suitable for all use cases, and a more targeted solution is needed to address the root cause of the issue. The fact that the issue is not related to payload size suggests that the problem lies in the architectural interaction between the plugin hook and the model runtime pipeline.

Recommendation

Apply workaround: Disabling the plugin that uses the before_prompt_build hook to set prependSystemContext is the safest immediate solution to prevent session corruption, until a more targeted fix can be developed and tested.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Plugin runtime: prependSystemContext via before_prompt_build causes occasional empty model outputs [1 comments, 2 participants]