Repository navigation
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 2:07 AM ET / 06:07 UTC. ClawSweeper reviewWhat this changesThis PR centralizes UTF-8-safe line accumulation for MCP stdio diagnostics and command output, preserving split characters, final partial stderr, carriage-return progress, and bounded unterminated output. Merge readinessKeep open: the branch still addresses current-main MCP stdio diagnostic corruption, and the prior lifecycle findings are resolved in the current head. No blocking patch defect was found; exact-head checks remain the remaining merge gate. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherOpenClaw launches configured MCP stdio servers and routes their stderr to operator diagnostics while agent and node-host runtimes own client shutdown. The shared process-output path also preserves selected command-output lines for callers after process completion. flowchart LR
A[MCP server stderr bytes] --> B[Stdio transport]
B --> C[UTF-8 line accumulator]
C --> D[Operator diagnostics]
E[Agent and node-host shutdown] --> F[Stream finalization]
F --> C
G[Command output bytes] --> C
C --> H[Preserved command lines]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +179, Tests +379. Total +558 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the shared accumulator and delayed stderr detach, then merge only after exact-head MCP, node-host, and process regressions confirm the two lifecycle consumers remain intact. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main decodes each stderr chunk independently, so splitting a multibyte byte sequence or logical line across chunks produces the reported corruption path. Is this the best way to solve the issue? Yes. A shared UTF-8 line owner is preferable to separate MCP and command-output decoders, and the disposal finalizer preserves the existing transport-close lifecycle before detaching stderr. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f14cf6b91028. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (14 earlier review cycles; latest 8 shown)
|
3fef855 to
95438a7
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
e5fd180 to
13df1fe
Compare
Co-authored-by: zhang-guiping <[email protected]>
215ca86 to
bd65731
Compare
|
Maintainer rewrite is pushed as bd65731, with contributor credit preserved. The PR body now records the before/after failures, real subprocess shutdown proof, 189 passing tests, local changed checks, independent review, and the 250 ms progress-framing tradeoff. The shared accumulator and command-output changes are gone; production growth is reduced from +179 to +36 lines. The rewrite also fixes the previous debounce starvation under sustained writes. CI on this commit must pass before landing. The prior review is older than 12 hours and the implementation has changed. @clawsweeper re-review |
|
Merged via squash.
|
Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
MCP stdio diagnostics were decoded and trimmed one stream chunk at a time. Splitting a Unicode character or a diagnostic line across writes corrupted the log. Disposal also detached stderr before closing the child, hiding diagnostics produced during shutdown.
Why This Change Was Made
The maintainer rewrite keeps the repair at the MCP transport/lifecycle owner. Node's
StringDecoderpreserves incomplete characters, the existingtruncateUtf8Suffixbounds pending diagnostics, and one finalizer handles EOF, stream close, and detach. The common client disposer retains stderr through graceful and forced cleanup.The original shared accumulator and command-output refactor are removed: command-output capture has different LF framing and retention rules. The rewritten progress timer starts on the first pending fragment instead of restarting on every write, so sustained newline-free output cannot postpone logging indefinitely.
Production: +82/-46, net +36, down from net +179. The remaining growth supplies bounded framing and lifecycle handling absent from the old adapter; a plain readline replacement would retain unbounded unterminated output and hide progress until EOF. Tests: +169/-0. Docs: +2/-0. No configuration, persistence, authorization, provider, or protocol changes.
User Impact
Operators retain intact Unicode diagnostics and final shutdown errors. CR/newline-delimited records are logged immediately. Unterminated progress is coalesced on a 250 ms interval without waiting for an idle gap; arbitrarily delayed chunks may become separate progress records, but incomplete Unicode characters remain buffered. An oversized diagnostic retains its UTF-8-safe 8 KiB tail with an explicit truncation marker.
Thanks to @zhangguiping-xydt for the original report and repair. The rewritten commit preserves the original contributor's co-author credit.
Evidence
Reviewed commit:
bd65731206e86f9158d7cf6e74a0c23a3b3492e6.Before editing production code, new tests failed against main
8585e7e04eef67c43e49a3db290d6d8e4f709ae3: a byte-split Unicode line produced 20 fragmented/corrupt entries instead of one; a real Node child writing an unterminated diagnostic on stdin EOF produced no diagnostic. Both pass after the repair.The nine stderr regressions cover byte boundaries, sustained writes, incomplete Unicode across a progress flush, CR/split-CRLF frames, truncation, natural EOF, listener cleanup, forced disposal, and a real subprocess's shutdown. The subprocess test uses the actual transport factory and common disposer, mocking only the log sink; it is not a provider/channel live test.
Passed:
Fresh Codex autoreview passed at its P0 threshold; independent owner/sibling review found no actionable findings. The installed MCP SDK's precreated stderr stream contract and Node decoder/pipe EOF behavior were inspected directly. Command-output capture remains unchanged and its tests pass.
One HTTP catalog recovery test hit its existing 50 ms request deadline during the first broad run. It passed in isolation and in the repeated original six-file order, without changing its timeout or assertions. Typechecking caught and fixed a writable-stream narrowing in the new test helper. An attempted remote changed-check run failed during file sync and was cancelled; its host was stopped. The successful changed checks above ran locally.
Current-main blame reaches a shallow-history boundary, so this review does not attribute the original introduction to that boundary commit.
CI on the rewritten commit is green: CI run 33011123364, including the required openclaw/ci-gate, and Workflow Sanity 33011123391. The stderr/subprocess boundary suites also passed three additional runs (20 tests per run). Native review artifacts are validated; landing uses the repository's prepare/merge workflow.