Skip to content

fix(exec): preserve stderr in node command results - #123602

Merged
steipete merged 1 commit into
mainfrom
fix/node-exec-output-loss
Aug 14, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/node-exec-output-loss

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #123600

What Problem This Solves

Fixes an issue where exec host=node hid stderr, truncation notices, and node error text whenever the command also emitted non-empty stdout. Agents could receive a completed-looking stdout fragment without the diagnostics explaining failure or incomplete output.

Why This Change Was Made

The node result formatter now builds one combined stdout/stderr/error rendering and uses it for both provider-visible content and details.aggregated. Node execution, stream caps, status/exit metadata, timeout/cancel behavior, custody, and warning rendering remain unchanged.

User Impact

Agents and operators now see the complete node command result, including stderr and the explicit truncation marker, even when stdout is present. Diagnostic details no longer disappear at the provider boundary.

Evidence

  • Tests-first regression reproduced visible output containing exactly small stdout\n while stderr's ... (truncated) marker and node command failed text were absent.
  • Post-fix focused node exec proof: 96/96 passed.
  • The regression asserts provider-visible content contains stdout, capped stderr, truncation notice, and error text, and matches the canonical diagnostic aggregate.
  • Blacksmith Testbox core + coreTests changed gate passed, including typechecks, changed lint, dead exports, import cycles, formatting, and storage/schema/architecture guards: https://github.com/openclaw/openclaw/actions/runs/31790868936 (tbx_01kzzvseq3exagr9jx42651z6z).
  • Final Codex autoreview: clean, no accepted/actionable findings; TruffleHog clean.
  • Exact reviewed head: 36696a6ad16467cc1a6a40e1aea144681d75fa6f.

Production delta: +3/-2, net +1. Tests: +28/-1, net +27.

AI-assisted: yes. The repair was reviewed against node system.run capture/truncation, direct invoke failure classification, exec result rendering, provider tool-result projection, local/background sibling formatters, and existing status/custody behavior.

@steipete steipete self-assigned this Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 14, 2026 10:24
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Aug 14, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 6:29 AM ET / 10:29 UTC.

ClawSweeper review

What this changes

The PR makes node-host exec results expose the same combined stdout, stderr, and error text to the agent as they retain in diagnostic details.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No blocking correctness findings. The PR repairs a source-proven loss of node stderr/error diagnostics; retain it for normal maintainer merge once exact-head checks complete.

Priority: P1
Reviewed head: 36696a6ad16467cc1a6a40e1aea144681d75fa6f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with a credible regression test and no correctness finding; exact-head CI remains the normal merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal formatting repair has focused regression evidence; the external-contributor real-behavior-proof gate does not apply.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal formatting repair has focused regression evidence; the external-contributor real-behavior-proof gate does not apply.
Evidence reviewed 6 items Current-main defect: The formatter renders only the first nonempty stream to model-visible content, while diagnostics already aggregate all three fields; nonempty stdout therefore suppresses stderr and error text.
Canonical owner and sibling callers: Both direct execution and the approval-complete path pass their successful node response through the same formatter, so one aggregate repairs both paths without changing dispatch, approvals, or capture.
Node capture contract: The node host separately captures stdout and stderr under a 200,000-byte combined cap and appends the truncation marker to stderr when applicable; the proposed formatter preserves that producer-owned information.
Findings None None.
Security None None.

How this fits together

Node-host exec sends a command through the Gateway to a paired node, then converts its structured stdout, stderr, and error response into an agent tool result. The formatter feeds both the model-visible result and execution diagnostics.

flowchart LR
A[Agent exec request] --> B[Gateway node command]
B --> C[Node stdout stderr and error]
C --> D[Node result formatter]
D --> E[Model tool result]
D --> F[Execution diagnostics]
Loading

Before merge

  • Resolve merge risk (P1) - Exact-head required checks are still in progress; merge only after they complete successfully on the reviewed head or its refreshed equivalent.
  • Complete next step (P2) - No repair job is needed: the proposed patch is focused and has no actionable review finding; await normal exact-head validation.
Agent review details

Security

None.

PR surface

Source +1, Tests +27. Total +28 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 2 +1
Tests 1 28 1 +27
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 31 3 +28

Review metrics

Metric Value Why it matters
Production vs test delta production +3/-2 (net +1); tests +28/-1 (net +27) The one production intermediate removes divergent visible/diagnostic rendering, while the added regression covers the reported mixed-stream failure.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #123600
Summary: This PR is the focused candidate repair for the reported node-exec diagnostic-loss bug.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the single shared aggregate at the node result-formatting boundary after exact-head validation; no change to node capture, approval, or execution policy is needed.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the single shared aggregate at the node result-formatting boundary after exact-head validation; no change to node capture, approval, or execution policy is needed.

Do we have a high-confidence way to reproduce the issue?

Yes—source reproducible: current main selects stdout || stderr || errorText for visible output while separately aggregating all fields, and the PR’s focused fixture supplies the mixed-stream case.

Is this the best way to solve the issue?

Yes—the shared formatter is the correct owner boundary because both direct and approval-complete node runs already converge there; reusing one aggregate eliminates the divergence without a second execution path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against c6fc12dc6745.

Labels

Label changes:

  • add P1: Lost stderr, truncation notices, and error text can leave agent node-exec failures looking successful to users.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal formatting repair has focused regression evidence; the external-contributor real-behavior-proof gate does not apply.

Label justifications:

  • P1: Lost stderr, truncation notices, and error text can leave agent node-exec failures looking successful to users.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal formatting repair has focused regression evidence; the external-contributor real-behavior-proof gate does not apply.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the current-main commit that introduced the node-exec phase formatter and the related output-truncation behavior. (role: recent node-exec feature contributor; confidence: high; commits: 54cf346abb21; files: src/agents/bash-tools.exec-host-node-phases.ts, src/node-host/invoke-system-run-allowlist.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for the in-progress exact-head checks before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit c2269f7 into main Aug 14, 2026
237 checks passed
@steipete
steipete deleted the fix/node-exec-output-loss branch August 14, 2026 10:37
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: node exec hides stderr whenever stdout is present

1 participant