Skip to content

fix(exec): long retained process output corrupts boundary emoji - #104531

Merged
steipete merged 2 commits into
openclaw:mainfrom
zhangguiping-xydt:fix/problem-process-supervisor-unicode
Jul 11, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
zhangguiping-xydt:fix/problem-process-supervisor-unicode

Conversation

@zhangguiping-xydt

@zhangguiping-xydt zhangguiping-xydt commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Long supervised stdout/stderr is retained behind a truncation marker. When the capture boundary landed between the two UTF-16 code units of an emoji or another non-BMP character, the retained output could contain a lone surrogate and render as a replacement character in downstream consumers such as on-exit run history.

Why This Change Was Made

The process supervisor now uses the repository's canonical sliceUtf16Safe helper at the capture owner. Streaming callbacks, byte-independent character limits, truncation markers, lifecycle behavior, schemas, and persistence are unchanged.

The maintainer refactor folded the regression into the existing bounded-stream test. One test now proves full streaming, per-stream markers, exact bounded tails, and the surrogate boundary without a parallel fixture; the final patch has one net production line and no net test growth.

User Impact

Before: a long command could expose malformed retained output when truncation bisected a surrogate pair.

After: the incomplete pair is dropped and retained stdout/stderr remains well-formed Unicode.

Evidence

  • Changed: src/process/supervisor/supervisor.ts
  • Regression: src/process/supervisor/supervisor.test.ts
  • Exact tested head: c50a6534bddccf8d0cf9c983a9cc64d953967641
  • Sanitized AWS Crabbox: run_56c83697a6cb, public network, no Tailscale, no instance profile, no credential hydration
  • Command: pnpm test src/process/supervisor/supervisor.test.ts
  • Result: exit 0
  • Fresh autoreview: no findings, correctness confidence 0.98
  • Hosted exact-head CI: running

Real behavior proof

  • Behavior addressed: bounded supervisor capture no longer retains half of a surrogate pair.

  • Reachability: child/PTY adapter output -> appendCapturedOutput -> RunExit.stdout / RunExit.stderr -> downstream process consumers.

  • Boundary crossed: production capture helper for both output streams, with the test also verifying that unbounded streaming callbacks receive the full original chunks.

  • Fix classification: root-cause fix.

  • Proof gap: no additional live gateway run was needed; the changed owner is deterministic and its exact production output projection is covered directly.

  • AI-assisted (Cursor and Codex)

  • I understand what the code does

  • Change is focused and does not mix unrelated concerns

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Jul 11, 2026
@clawsweeper

clawsweeper Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 11, 2026, 4:23 PM ET / 20:23 UTC.

Summary
The PR replaces unsafe retained stdout/stderr tail slicing with the shared UTF-16-safe helper and updates the bounded-output test to cover surrogate boundaries.

PR surface: Source +1, Tests 0. Total +1 across 2 files.

Reproducibility: yes. from source with high confidence: current main can start the bounded retained tail on a low surrogate, and the exact-head regression constructs that boundary for both streams. No actual child or PTY reproduction artifact was supplied.

Review metrics: none identified.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add a redacted terminal transcript, live output, log, recording, or linked artifact from an actual supervised child or PTY that crosses the surrogate truncation boundary.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The focused exact-head Crabbox run covers production capture logic through createStubChildAdapter, but no redacted actual child or PTY output shows the after-fix retained result; updating the PR body with proof should trigger re-review, or a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The submitted evidence does not demonstrate corrected retained RunExit output through an actual child or PTY adapter, so the external-contributor real-behavior merge gate remains unmet despite strong deterministic coverage.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the centralized safe-tail implementation and add a redacted real child or PTY run showing that boundary truncation produces well-formed retained output while streaming remains unchanged.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] No code repair is indicated; maintainers should require the missing real-adapter artifact or explicitly record a proof override before merge.

Maintainer decision needed

  • Question: Should this exact head require a real child or PTY proof artifact, or should maintainers explicitly override the external-PR proof gate based on the deterministic capture-owner test?
  • Rationale: Repository policy requires real after-fix behavior proof for external code PRs, while the maintainer closeout argues that the deterministic owner-level test sufficiently proves this narrowly pure transformation.
  • Likely owner: steipete — They introduced and recently reviewed the supervisor capture surface and performed the exact-head test consolidation.
  • Options:
    • Require real adapter proof (recommended): Keep the PR open until a redacted actual child or PTY run shows corrected retained output on this exact head.
    • Approve proof override: Record an explicit proof override and allow the otherwise-correct patch to proceed through normal merge gates.

Security
Cleared: The patch changes one internal string operation and its regression test without altering dependencies, permissions, secrets, build hooks, package resolution, or executable supply-chain inputs.

Review details

Best possible solution:

Keep the centralized safe-tail implementation and add a redacted real child or PTY run showing that boundary truncation produces well-formed retained output while streaming remains unchanged.

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

Yes, from source with high confidence: current main can start the bounded retained tail on a low surrogate, and the exact-head regression constructs that boundary for both streams. No actual child or PTY reproduction artifact was supplied.

Is this the best way to solve the issue?

Yes. Fixing the shared capture owner with the existing surrogate-safe helper is narrower and more maintainable than repairing individual RunExit consumers or introducing another truncation path.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This fixes malformed retained process output in a bounded edge case without affecting core availability, delivery, security, or persisted configuration.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The focused exact-head Crabbox run covers production capture logic through createStubChildAdapter, but no redacted actual child or PTY output shows the after-fix retained result; updating the PR body with proof should trigger re-review, or a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +1, Tests 0. Total +1 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 1 +1
Tests 1 10 10 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 12 11 +1

What I checked:

Likely related people:

  • steipete: Git history ties the current supervisor capture implementation to commit ea2b558, and the PR head includes their focused regression-test consolidation and exact-head review. (role: introduced behavior and recent area contributor; confidence: high; commits: ea2b558e5eea, c50a6534bddc; files: src/process/supervisor/supervisor.ts, src/process/supervisor/supervisor.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • 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.
Review history (2 earlier review cycles)
  • reviewed 2026-07-11T15:11:14.957Z sha 7f9b9ab4658a3efe7e8684fb798b025128dd5dac :: needs maintainer review before merge. :: none
  • reviewed 2026-07-11T20:16:42.579Z sha c50a653 :: needs real behavior proof before merge. :: none

@steipete
steipete force-pushed the fix/problem-process-supervisor-unicode branch from 7f9b9ab to c50a653 Compare July 11, 2026 20:05
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 11, 2026
@steipete

Copy link
Copy Markdown
Contributor

Maintainer closeout complete on exact head c50a6534bddccf8d0cf9c983a9cc64d953967641.

  • Kept the root fix to one production line at the shared supervisor capture owner.
  • Folded the surrogate-boundary regression into the existing bounded-stream test, leaving no net test growth while proving exact stdout/stderr tails and full streaming.
  • Sanitized AWS Crabbox run_56c83697a6cb: focused supervisor suite passed.
  • Fresh autoreview: no findings, correctness confidence 0.98.
  • Targeted formatting and diff checks passed.
  • Hosted exact-head CI is green.

Ready to land.

@steipete steipete self-assigned this Jul 11, 2026
@steipete
steipete merged commit 2077ebe into openclaw:main Jul 11, 2026
124 of 128 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 12, 2026
…claw#104531)

* fix(process): preserve Unicode in captured output tails

* test(process): consolidate captured output coverage

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants