fix(openclaw): make the rewrite plugin work end-to-end on OpenClaw 2026.6.x#2392
Closed
davidbordenwi wants to merge 1 commit into
Closed
fix(openclaw): make the rewrite plugin work end-to-end on OpenClaw 2026.6.x#2392davidbordenwi wants to merge 1 commit into
davidbordenwi wants to merge 1 commit into
Conversation
1. rtk rewrite exits 3 (rewrite/ask) with the rewrite on stdout; execFileSync throws on non-zero exit, so the plugin never rewrote anything. Recover status 3 from the error object; pass through on 1/2 so native deny policy sees the original command. 2. Managed installs reject TypeScript entries - ship compiled index.js and point main at it (index.ts kept as source). 3. package.json needs openclaw.extensions for managed installs to register the entry point. 4. Hook-only plugins are excluded from the Gateway startup plugin plan unless the manifest declares activation intent - without activation.onCapabilities ["hook"], the agent runtime silently skips the plugin (inspect says loaded, daemon-served turns never rewrite).
|
|
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.
Summary
The OpenClaw plugin as shipped never rewrites anything on current OpenClaw (tested against 2026.6.5). This PR is the complete working set — four independent defects fixed together, verified end-to-end against live gateways. Fixes 1–3 overlap with open PRs #2202/#2220 (exit code 3), #2113 (TS build), and #1236/#1455 (extensions metadata) — credit to those authors; any one of them alone still leaves the plugin broken. Fix 4 is, as far as I can tell, not reported anywhere yet and is required even with 1–3 applied.
Closes #1810
Closes #944
Closes #1719
The four defects
rtk rewritesignals a rewrite with exit code 3 (rewrite/ask) and the rewrite on stdout (perhooks/claude/rtk-rewrite.sh: 0+stdout allow-rewrite, 1 no-equivalent, 2 deny, 3+stdout ask-rewrite).execFileSyncthrows on non-zero exit, sotryRewritereturnednullfor every ask-classified rewrite — i.e. nearly always. Fixed by recovering status 3 + stdout from the thrown error, and passing through on 1/2 so the host's native deny policy still sees the original command.index.js(types stripped, logic identical) withmainpointing at it;index.tsstays as source.openclaw.extensions— required in package.json for managed installs to register the entry point."activation": { "onCapabilities": ["hook"] }, the agent runtime's restricted plugin load silently skips the plugin:plugins inspectreports loaded and embedded CLI runs rewrite, but daemon-served agent turns never do. A daemon can even mask this intermittently — any unrestricted plugin-load event in the process (e.g. a subagent spawn) registers the hooks for the process lifetime, which makes the failure look nondeterministic across identically-configured gateways.Verification
A/B against a throwaway local OpenClaw 2026.6.5 gateway: pre-fix, a daemon-served
execofls -la <dir>returns raw output; post-fix the identical turn returns the rtk-compressed form, with the rewritten command recorded in rtk's gain history and the original command preserved in the session transcript (the host applies rewritten params at execution time only — worth knowing when verifying: the transcript is not evidence of failure).