fix: remove duplicate system prompt in CleanContextRunner#84
Open
withRiver wants to merge 1 commit into
Open
Conversation
The CleanContextRunner was passing the system prompt via two paths simultaneously: 1. config.agents.defaults.systemPromptOverride (primary) 2. extraSystemPrompt parameter (legacy fallback) On openclaw >= 2026.4.7, both paths are active, causing the same prompt to appear twice in the final system message, wasting tokens per LLM call. On openclaw < 2026.4.7, recommend enabling the LLM configuration item for the plugin, so as to use the StandaloneLLMRunner Remove the extraSystemPrompt parameter since systemPromptOverride fully handles the system prompt injection. This fixes the duplication for all downstream consumers: L1 extraction, L1 dedup, L2 scene extraction, and L3 persona generation.
Contributor
|
Reviewer triage notes: CI blocker:
Compatibility blocker / decision needed:
Suggested resolution: either bump the declared minimum OpenClaw version to the version where |
Contributor
|
I opened #86 as a compatibility-preserving alternative to this PR. It keeps |
Collaborator
|
感谢发现 system prompt 重复注入的问题!我们会评估最佳方案后跟进,感谢关注! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CleanContextRunner was passing the system prompt via two paths simultaneously:
On openclaw >= 2026.4.7, both paths are active, causing the same prompt to appear twice in the final system message, wasting tokens per LLM call.
Remove the extraSystemPrompt parameter since systemPromptOverride fully handles the system prompt injection. This fixes the duplication for all downstream consumers: L1 extraction, L1 dedup, L2 scene extraction, and L3 persona generation.
Problem
CleanContextRunnerpasses the system prompt torunEmbeddedPiAgentvia two paths simultaneously:config.agents.defaults.systemPromptOverride— the primary path, which completely replaces the default agent system promptextraSystemPromptparameter — a legacy fallback intended for older versions of openclawOn current versions of openclaw, both paths are active. In
openclaw/src/agents/pi-embedded-runner/run/attempt-system-prompt.ts,buildAttemptSystemPromptprocesses them as follows:When
systemPromptOverrideTextis present,appendRuntimeExtraSystemPromptappendsextraSystemPromptafter it. Since both contain the same content (e.g.EXTRACT_MEMORIES_SYSTEM_PROMPT), the final system message becomes:This affects all modules that use
CleanContextRunner:l1-extractor.ts)l1-dedup.ts)scene-extractor.ts)persona-generator.ts)Impact
Fix
Remove the
extraSystemPromptparameter from therunEmbeddedPiAgentcall inCleanContextRunner.run(). The system prompt is already fully handled viaconfig.agents.defaults.systemPromptOverride.After this fix, on openclaw < 2026.4.7, users should enable the LLM configuration item for the plugin, so as to use the StandaloneLLMRunner instead of CleanContextRunner.
Changes
src/utils/clean-context-runner.ts: RemoveeffectiveSystemPromptvariable andextraSystemPromptparameter passed torunEmbeddedPiAgent