Repository navigation
fix: apply output reducers in headless and Code Mode calls - #199424
Closed
roboclaw-bot wants to merge 2 commits into
Closed
roboclaw-bot wants to merge 2 commits into
roboclaw-bot wants to merge 2 commits into
Conversation
Use the prepared plugin registry for middleware discovery and apply result middleware at the native catalog boundary. Recommend terminal collection for bounded commands and clarify Tokenjuice verification. Co-authored-by: vincentkoc <[email protected]>
Worked on by: - @vincentkoc Co-authored-by: vincentkoc <[email protected]> OpenClaw-Publication: c09834cf-a11f-89ad-b92c-4f9b61b6725a
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
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.
What Problem This Solves
Fixes enabled tool-output reducers silently being skipped in headless runs and nested Code Mode tool calls.
User Impact
Enabled middleware such as Tokenjuice can transform actual OpenClaw tool results before they reach the agent, including nested Code Mode shell calls. Exact file/schema results and the surrounding JavaScript envelope retain their existing contracts. Bounded-command guidance now recommends the existing terminal-result collection path instead of avoidable short-yield/poll cycles.
No new configuration, dependencies, permission changes, or migrations. Native Codex shell results remain outside this replacement path. This PR does not claim a whole-task token-savings percentage.
Why This Change Was Made
Headless runs prepare a scoped plugin generation, but middleware discovery consulted the process-global registry and could select no callback or a different same-ID root plugin. Discovery now follows the current context and its prepared lazy-load inputs. Native catalog calls also apply the existing middleware once before guest serialization, using the arguments actually executed after policy adjustment.
The exec runtime already supports
awaitResults; the prompt and documentation now explain when to use it. Tokenjuice guidance distinguishes real output replacement from plugin inventory status and separates native replacement, explicit wrapping, failure preservation, and complete-task measurements.Evidence
pnpm buildpasses (it emits UI size-budget advisory warnings; this change does not touch UI source). Built real-model headless runs pass with direct tools and Code Mode: automatic inventory compaction is 5,647 → 470 characters including the notice; exit 7/sentinel, exact file bytes, and the returned schema object are preserved. No manual CLI wrapper or global-root activation workaround.Requested by @vincentkoc.
Work sessions
Linked for team reference; these sessions aren’t public.
Worked on by