Skip to content

fix(signal): surface daemon errors split across output chunks - #104152

Merged
steipete merged 2 commits into
openclaw:mainfrom
qingminglong:codex/fix-signal-daemon-line-buffer
Jul 12, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
qingminglong:codex/fix-signal-daemon-line-buffer

Conversation

@qingminglong

@qingminglong qingminglong commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes Signal daemon diagnostics being classified from arbitrary stdout/stderr chunks instead of complete text lines. A real error such as ERROR or Failed to initialize HTTP Server could be split across pipe reads and emitted as ordinary fragments; a multibyte UTF-8 character split at the same boundary could also be corrupted.

Why This Change Was Made

The shared Signal daemon output boundary now delegates UTF-8 decoding, line framing, CRLF/LF handling, and the final unterminated line to Node's readline interface before applying the existing severity classifier. This is the narrow owner-boundary fix for both stdout and stderr and leaves daemon lifecycle, configuration, and channel delivery unchanged.

Maintainer refactor:

  • documented the line-framing and UTF-8 invariant at the process-pipe seam;
  • extended the regression to split a real UTF-8 code point as well as the ERROR token;
  • rebased the contributor's implementation onto current main while preserving authorship.

User Impact

Signal operators get one correctly classified daemon diagnostic even when the operating system splits a line or UTF-8 code point across reads. Routine warnings remain logs; error-like lines still update error state.

Evidence

Best-Fix Judgment

Best bounded fix. A custom chunk buffer would need to reimplement UTF-8 decoding, CRLF handling, and final-line flushing; changing severity policy would address the wrong layer. One readline interface per child stream gives the existing classifier the complete lines it already expects.

Provenance: the per-chunk classification behavior traces to eefbf3dc5a995ea6a1a3eb66f90a5f76dbff3ae7 (2026-02-22) and was carried into the Signal plugin boundary by #45531; it has shipped since v2026.3.22.

AI-assisted: yes. Maintainer review covered the complete daemon module, both child streams, classifier policy, process lifecycle, adjacent tests, Signal docs, Node's installed readline implementation contract, current main, shipped tags, real signal-cli, and fresh autoreview.

@openclaw-barnacle openclaw-barnacle Bot added channel: signal Channel integration: signal size: XS labels Jul 11, 2026
@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. 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 maintainer review before merge. Reviewed July 11, 2026, 1:13 AM ET / 05:13 UTC.

Summary
The PR buffers Signal daemon stdout and stderr into complete lines before severity classification and adds regression coverage for split chunks, CRLF/LF delimiters, and a final unterminated line.

PR surface: Source +4, Tests +24. Total +28 across 2 files.

Reproducibility: yes. Current-main source clearly classifies child-process chunks independently, and the focused test plus real-daemon transcript demonstrate the split-line failure and corrected result.

Review metrics: none identified.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

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

Rank-up moves:

  • [P2] Refresh the branch and rerun the two shared QA smoke jobs before merge; their current failures occur in runtime-build setup rather than the Signal surface.

Risk before merge

  • [P1] The branch is behind current main and the two shared QA smoke jobs currently fail during runtime-build setup, so the exact refreshed merge head still needs those checks rerun before landing.

Maintainer options:

  1. Decide the mitigation before merge
    Land the plugin-owned complete-line framing for both Signal daemon streams, retaining the focused regression and real-daemon evidence while leaving classification, lifecycle, configuration, and delivery contracts unchanged.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P2] No automated code repair is needed; refresh the behind branch, rerun the shared QA smoke checks, and route ordinary review to the Signal history owners.

Security
Cleared: The plugin-local stream-framing and test changes introduce no dependency, workflow, permission, secret, package-resolution, artifact-download, or supply-chain concern.

Review details

Best possible solution:

Land the plugin-owned complete-line framing for both Signal daemon streams, retaining the focused regression and real-daemon evidence while leaving classification, lifecycle, configuration, and delivery contracts unchanged.

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

Yes. Current-main source clearly classifies child-process chunks independently, and the focused test plus real-daemon transcript demonstrate the split-line failure and corrected result.

Is this the best way to solve the issue?

Yes. Complete-line framing at the plugin-owned child stdout/stderr boundary is the narrowest maintainable solution; changing severity policy or daemon lifecycle would address the wrong layer.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: The PR fixes a bounded Signal daemon diagnostic-severity bug without changing message delivery, configuration, persisted state, or process lifecycle.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR supplies redacted terminal output from a real signal-cli daemon run with deliberately fragmented stderr, showing one reconstructed error-level record after the fix.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies redacted terminal output from a real signal-cli daemon run with deliberately fragmented stderr, showing one reconstructed error-level record after the fix.
Evidence reviewed

PR surface:

Source +4, Tests +24. Total +28 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 12 8 +4
Tests 1 24 0 +24
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 36 8 +28

What I checked:

  • Current-main bug: Current main applies severity classification separately to every stdout or stderr chunk, so a line split into ER and ROR ... is emitted as ordinary fragments rather than one error diagnostic. (extensions/signal/src/daemon.ts:66, a6bdc8092bf2)
  • Narrow implementation: The proposed helper creates one line reader for each child stdout/stderr stream and retains the existing classifier, logging callbacks, process lifecycle, configuration, and delivery behavior. (extensions/signal/src/daemon.ts:67, 9ea914269198)
  • Regression coverage: The added test forces an error token across two chunks and verifies CRLF, LF, and final unterminated-line handling without duplicate or fragmented records. (extensions/signal/src/daemon.test.ts:50, 9ea914269198)
  • Runtime contract proof: A read-only Node 24 probe reconstructed the split error line, recognized CRLF and LF boundaries, and emitted the final unterminated line exactly as the patch expects. (extensions/signal/src/daemon.ts:67, 9ea914269198)
  • Real-daemon proof: The updated PR body reports a redacted signal-cli 0.14.5 run whose stderr was relayed in at most two-byte writes, producing exactly one reconstructed Failed to initialize HTTP Server error record; the repository real-behavior-proof check passes. (9ea914269198)
  • Feature provenance: The per-chunk splitting behavior dates to the original Signal severity-classification change, while later commits added untagged failure classification and typed daemon lifecycle handling. (src/signal/daemon.ts:54, 351db0632d97)

Likely related people:

  • steipete: Peter Steinberger introduced Signal support, the severity-classification path, untagged failure handling, and the typed daemon lifecycle that this patch preserves. (role: feature owner; confidence: high; commits: 596770942adb, 351db0632d97, e92b48062936; files: src/signal/daemon.ts, extensions/signal/src/daemon.ts)
  • scoootscooob: This person authored and merged the change that moved Signal implementation into the current bundled-plugin boundary. (role: feature refactor author; confidence: high; commits: 4540c6b3bc12; files: src/signal/daemon.ts, extensions/signal/src/daemon.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 (1 earlier review cycle)
  • reviewed 2026-07-11T04:17:24.043Z sha 9ea914269198d773adabe2a896ba16e4a78d3b06 :: needs real behavior proof before merge. :: none

@qingminglong

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed 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. labels Jul 11, 2026
@steipete steipete self-assigned this Jul 12, 2026
@steipete
steipete force-pushed the codex/fix-signal-daemon-line-buffer branch from 9ea9142 to 9c54b45 Compare July 12, 2026 19:55
@steipete

Copy link
Copy Markdown
Contributor

Land-ready maintainer proof for exact head 9c54b4515123ba0459bf058a8ba16a458553cacb:

  • Best fix: one Node readline interface per daemon stdout/stderr stream owns UTF-8 decoding, line framing, CRLF/LF, and final unterminated-line flushing before the existing severity classifier runs. A custom buffer would duplicate those contracts; classifier changes would target the wrong layer.
  • Regression: 5/5 focused tests cover split ERROR, CRLF, LF, the final unterminated line, severity routing, and a UTF-8 code point split between chunks.
  • Independent live proof on Blacksmith Testbox tbx_01kxbxzfw904j2hn0nfnt48ndg: official signal-cli 0.14.5, empty temporary data, deliberately occupied HTTP port, and a relay capped at two-byte writes. Result: exactly one signal-cli: Failed to initialize HTTP Server error record and zero ordinary fragments.
  • Fresh post-rebase Testbox tbx_01kxby4m86gdtr7zmeht8ff2g4: focused suite 5/5; conflict, attribution, extension-boundary, dependency-pin, duplicate-target, and format gates passed.
  • Fresh branch autoreview: no actionable findings, confidence 0.95.
  • Exact-head Real behavior proof: https://github.com/openclaw/openclaw/actions/runs/29206738875 passed.
  • Exact-head full CI: https://github.com/openclaw/openclaw/actions/runs/29206739588 passed.
  • Native scripts/pr review-validate-artifacts 104152 and scripts/pr prepare-run 104152 passed; prepare head equals the live PR head.
  • The local changed-gate Plugin SDK hash mismatch is unrelated current-main drift: this PR's two Signal-private files do not feed the Plugin SDK baseline, and hosted exact-head SDK/boundary gates passed.

Provenance: the per-chunk classification behavior traces to eefbf3dc5a995ea6a1a3eb66f90a5f76dbff3ae7 (2026-02-22), moved into the Signal plugin by #45531, and has shipped since v2026.3.22.

@steipete
steipete merged commit bf642ef into openclaw:main Jul 12, 2026
116 of 120 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 13, 2026
…aw#104152)

* fix(signal): preserve daemon log lines across chunks

* test(signal): cover split utf-8 daemon output

---------

Co-authored-by: Peter Steinberger <[email protected]>
RomneyDa pushed a commit that referenced this pull request Aug 30, 2026
* fix(signal): preserve daemon log lines across chunks

* test(signal): cover split utf-8 daemon output

---------

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

Labels

channel: signal Channel integration: signal P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

2 participants