Repository navigation
fix(process): preserve safe mixed-stream command diagnostics - #134428
Conversation
A visible stderr warning hid actionable stdout in failed command errors. Normalize each stream once and retain independent recent tails within the existing error detail budget. Preserve termination reasons, single-stream result caps, progress redraw handling, and UTF-16 boundaries. Reuse the raw Git command owner for trimmed output to remove duplicated execution and failure handling. Keep worktree cleanup and command capture unchanged.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 4:50 PM ET / 20:50 UTC. ClawSweeper reviewWhat this changesThe PR preserves and safely renders both stderr and stdout in failed-command diagnostics within a shared 2,000-character budget, with regression coverage for managed-worktree cleanup. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessNo introduced correctness or security defect was found. Current main and the latest release still discard stdout when stderr is nonempty, so this member-authored, maintainer-labeled PR remains necessary; exact-head CI must complete before merge readiness is established. Priority: P2 Review scores
Verification
How this fits togetherManaged worktree setup runs a repository setup command and turns a nonzero result into an operator-facing failure. The shared formatter also supplies diagnostics for Git and Gmail command callers. flowchart LR
A[Setup command] --> B[Command output capture]
B --> C[Shared diagnostic formatter]
C --> D[Failed worktree cleanup]
C --> E[Operator error message]
D --> F[Registry and Git state removed]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +42, Tests +138. Total +180 across 3 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the centralized formatter after exact-head CI is green; retain the separate normalizer, tail renderer, and allocator as the canonical implementation for safe mixed-stream diagnostics. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main’s stderr-or-stdout selection at src/process/command-error.ts:44-45 directly loses stdout whenever stderr is visible, and the added worktree boundary test exercises that path. This read-only review did not execute the reproduction. Is this the best way to solve the issue? Yes. Repairing the shared command-error owner fixes managed worktrees while preserving the separate 800-character formatter used by Git and Gmail callers; no duplicate implementation path was found. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9b123e263448. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
@clawsweeper re-review The head now fixes the dynamic shared-budget and terminal-control findings, removes the unrelated |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…w#134428) * fix(process): retain both streams in command failure details A visible stderr warning hid actionable stdout in failed command errors. Normalize each stream once and retain independent recent tails within the existing error detail budget. Preserve termination reasons, single-stream result caps, progress redraw handling, and UTF-16 boundaries. Reuse the raw Git command owner for trimmed output to remove duplicated execution and failure handling. Keep worktree cleanup and command capture unchanged. * fix(process): preserve safe mixed-stream diagnostics --------- Co-authored-by: Vincent Koc <[email protected]>
Reuse the canonical output normalizer and suffix fitter for mixed-stream command errors, preserving terminal sanitation, shared budgets, Unicode boundaries, termination reasons, and independent result-output limits. Follow up on #134428 without reintroducing the Git facade consolidation owned by #132180. Production shrinks by 42 lines, offsetting the original repair's 42-line increase. Add focused behavioral controls; the landed original already passes the 22-case formatter baseline. Co-authored-by: Vincent Koc <[email protected]>
) Reuse the canonical output normalizer and suffix fitter for mixed-stream command errors, preserving terminal sanitation, shared budgets, Unicode boundaries, termination reasons, and independent result-output limits. Follow up on openclaw#134428 without reintroducing the Git facade consolidation owned by openclaw#132180. Production shrinks by 42 lines, offsetting the original repair's 42-line increase. Add focused behavioral controls; the landed original already passes the 22-case formatter baseline. Co-authored-by: Vincent Koc <[email protected]>
Fixes #134427
What Problem This Solves
Fixes an issue where users creating a managed worktree could lose the setup script's recovery instruction when the script also wrote a warning to stderr. The first repair retained both streams, but still truncated uneven output despite unused space and allowed terminal control bytes into the diagnostic.
Why This Change Was Made
The shared command-error owner now normalizes each stream once, labels mixed output, and allocates the existing 2,000-character detail budget dynamically. Short streams keep only what they need; remaining capacity goes to the longer stream, with omission markers counted inside the budget and UTF-16-safe tail slicing.
ANSI and carriage-return redraws are normalized before each logical line is sanitized. Newlines remain real line boundaries, tabs render visibly, and executable C0/C1/DEL controls are removed. Single-stream output, termination reasons, suffix tails, Buffer/string handling, and the separate 800-character result formatter remain unchanged.
The unrelated
git-execconsolidation was removed completely because #132180 already owns that work.User Impact
Failed commands now retain both warnings and recovery instructions when the combined useful output fits the established budget. Oversized output remains bounded and safe to render in terminals and logs. Worktree failure cleanup behavior is unchanged.
Production: 51 lines added, 9 removed, net +42. Tests: 138 lines added.
Evidence
Before the follow-up, two focused regressions failed:
After the repair:
command-error, Git diagnostics, managed-worktree cleanup, and Gmail command-result consumers;pnpm check:changedpassed all selected core/core-test types, lint, schema, database, sidecar, import-cycle, webhook, and pairing guards;pnpm tsgo:test:src,pnpm check:import-cycles, formatting, andgit diff --checkpassed;src/infra/git-exec.tsandsrc/infra/git-exec.test.tsare byte-identical to the PR base.