fix(agents): handle stdout/stderr stream errors in ssh sandbox commands#101031
Conversation
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
dbfc1f2 to
dc54abc
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 10:13 PM ET / 02:13 UTC. Summary PR surface: Source +17, Tests +137, Other +108. Total +262 across 3 files. Reproducibility: yes. Current main lacks stream error listeners on the SSH command/upload streams, and a direct Node EventEmitter probe confirms an emitted error without a listener throws. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the focused SSH helper fix once maintainer review and current-base merge verification are satisfied, keeping stream-error ownership in src/agents/sandbox/ssh.ts. Do we have a high-confidence way to reproduce the issue? Yes. Current main lacks stream error listeners on the SSH command/upload streams, and a direct Node EventEmitter probe confirms an emitted error without a listener throws. Is this the best way to solve the issue? Yes. Handling stream failures in src/agents/sandbox/ssh.ts is the narrow owner-boundary fix because that module owns the spawned SSH/tar streams and sibling process wrappers already treat stdio failures as command failures. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b1da734a1e7d. Label changesLabel justifications:
Evidence reviewedPR surface: Source +17, Tests +137, Other +108. Total +262 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (4 earlier review cycles)
|
dc54abc to
604978a
Compare
|
@clawsweeper re-review 修复了 ssh sandbox 的两个问题:
真实 proof 脚本已加入并运行通过,输出在 PR body 中。本地验证:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review\n\nBranch rebased onto latest upstream/main. Test and proof both pass locally; proof output is in the PR body. |
da7ecfd to
5ad0d2f
Compare
|
Closing temporarily to make room under the 20-active-PR limit for higher-priority fixes. Will reopen once other PRs land or are closed. |
|
Reopening; closing newer QA-lab PRs instead to respect the 20-active-PR limit. |
5ad0d2f to
51b0d2f
Compare
51b0d2f to
1d5fe13
Compare
b8a5b45 to
fe7ca02
Compare
|
Land-ready maintainer fixup complete at
Known proof gaps: none. |
|
Merged via squash.
|
…ds (openclaw#101031) * fix(agents): handle stdout/stderr stream errors in ssh sandbox commands * fix(agents): also handle stdin stream errors in ssh sandbox command * fix(agents): handle tar/ssh pipeline stream errors in sandbox upload * fix(agents): kill ssh child on stdout/stderr/stdin stream errors in sandbox * fix(agents): move upload fail helper before use to avoid TDZ in ssh sandbox * docs(proof): note ssh-sandbox upload TDZ fix in proof header * fix(agents): harden SSH sandbox stream errors --------- Co-authored-by: Peter Steinberger <[email protected]>
…ds (openclaw#101031) * fix(agents): handle stdout/stderr stream errors in ssh sandbox commands * fix(agents): also handle stdin stream errors in ssh sandbox command * fix(agents): handle tar/ssh pipeline stream errors in sandbox upload * fix(agents): kill ssh child on stdout/stderr/stdin stream errors in sandbox * fix(agents): move upload fail helper before use to avoid TDZ in ssh sandbox * docs(proof): note ssh-sandbox upload TDZ fix in proof header * fix(agents): harden SSH sandbox stream errors --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
runSshSandboxCommandanduploadDirectoryToSshTargetspawn ssh/tar children and read stdout/stderr. If any of those streams emits an error event, it is not handled and can become an unhandled exception. InuploadDirectoryToSshTargetthefailhelper was also referenced before its declaration, causing a temporal dead zone error when registering the stream error listeners.Why This Change Was Made
failhelper inuploadDirectoryToSshTargetbefore its first use so the tar-over-ssh pipeline can register its stream error listeners correctly.User Impact
SSH sandbox command and upload operations are more resilient to transient stream failures and no longer fail with a TDZ error on upload.
Evidence
src/agents/sandbox/ssh.stream-errors.test.tsto assert that the ssh child is killed on stdout/stderr/stdin stream errors.scripts/proof/ssh-sandbox-stream-errors.mtscovering all three stream errors.node scripts/run-vitest.mjs src/agents/sandbox/ssh.test.ts src/agents/sandbox/ssh.stream-errors.test.tspassedOPENCLAW_OXLINT_SKIP_PREPARE=1 node scripts/run-oxlint.mjs src/agents/sandbox/ssh.ts src/agents/sandbox/ssh.stream-errors.test.ts scripts/proof/ssh-sandbox-stream-errors.mtspassednode --import tsx scripts/proof/ssh-sandbox-stream-errors.mts: