Skip to content

fix(openclaw): preserve rewrite stdout on non-zero exit#1389

Open
jhenderiks wants to merge 1 commit intortk-ai:developfrom
jhenderiks:fix/openclaw-rewrite-exit-3
Open

fix(openclaw): preserve rewrite stdout on non-zero exit#1389
jhenderiks wants to merge 1 commit intortk-ai:developfrom
jhenderiks:fix/openclaw-rewrite-exit-3

Conversation

@jhenderiks
Copy link
Copy Markdown

@jhenderiks jhenderiks commented Apr 18, 2026

Summary

Why this change

The current OpenClaw plugin assumes that useful rewrite output only arrives on exit 0.

That is brittle. If rtk rewrite emits a rewritten command on stdout together with a non-zero exit status, the current execSync(...) path throws and the plugin drops the rewrite.

This PR makes the plugin preserve rewritten stdout on non-zero exit instead of treating all non-zero exits as unrecoverable.

Test plan

  • bun --eval 'await import("./openclaw/index.ts")'
  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • Manual verification in an environment where rtk rewrite emits rewritten stdout with non-zero exit

Notes

I am intentionally framing this as a defensive correctness fix.

I originally saw a repro where rtk rewrite emitted rewritten stdout with a non-zero exit, but I did not re-confirm that exact exit behavior on every RTK/environment combination before sending this PR.

Signed-off-by: Justin Henderiks <jhenderiks@users.noreply.github.com>
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 18, 2026

CLA assistant check
All committers have signed the CLA.

@pszymkowiak pszymkowiak added bug Something isn't working effort-small Quelques heures, 1 fichier labels Apr 18, 2026
@pszymkowiak
Copy link
Copy Markdown
Collaborator

[w] wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Fixes the OpenClaw plugin to preserve stdout from rtk rewrite when the child process exits with status 3. Previously, execSync would throw on non-zero exit codes, discarding the rewritten output. The fix extracts the exit status and stdout from the caught error object and returns the rewritten command when appropriate.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #1388


Analyzed automatically by wshm · This is an automated analysis, not a human review.

@jhenderiks jhenderiks changed the title fix(openclaw): preserve rewrite stdout on exit 3 fix(openclaw): preserve rewrite stdout on non-zero exit Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working effort-small Quelques heures, 1 fichier

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants