Skip to content

fix(irc): preserve code in replies across message boundaries - #138328

Merged
steipete merged 1 commit into
mainfrom
codex/qa-irc-render-order-20260904
Sep 4, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-irc-render-order-20260904

Conversation

@steipete

@steipete steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor
Additional instructions

Maintainers can update this branch through normal repository access.

What Problem This Solves

Fixes an issue where long IRC replies lost literal formatting characters inside code. If a chunk contained only a closing code fence, the entire nonempty reply could fail before sending anything.

Why This Change Was Made

The IRC sender now renders the complete logical message into plain text before splitting it. It owns one canonical preparation step, then the existing plain-text chunker plans the physical messages. This deletes duplicate raw-Markdown length/newline splitting, empty-chunk fallback paths and an unused private target override.

Production +29/−54, net −25; regression tests +107; docs +14. Direct and formatted sends retain account limits, reply scope, one transient connection per batch, cancellation/readiness checks, wire sanitization and receipts. Configuration, storage, protocol, dependencies and security policy are unchanged.

User Impact

Code literals and link destinations survive message boundaries, and a closing fence cannot make an otherwise valid reply disappear. IRC documentation describes the plain-text behavior and a normal CLI send.

Evidence

  • Four real-renderer regressions fail before the repair: fenced literals, a closing-fence boundary, inline literals and a long link. 87 focused tests pass, with seven final tests rerun after a mechanical regex spelling correction.
  • Seven actual local TCP scenarios pass with the exact declared markdown-it15.0.1 distribution. The dependency archive was independently integrity-checked and used only in the proof harness; installed dependencies were unchanged.
  • The complete four-file canonical changed gate passes. Its first attempt found a test-only regex spacing lint issue; the final spelling preserves the assertion. Independent managed P2 review is clean, confidence0.95.
  • Matched normal CLI and running Gateway flows load the baseline and candidate IRC plugins through plugins.load.paths into the same trusted packaged core. Before, the long-code reply returns success after losing literal asterisks; the fence-boundary reply fails with zero sends. After, both and a recovery reply succeed, preserve the text, return normal results/receipts, stay within512-byte IRC frames, and use exactly one connection and clean disconnect per batch. All task-owned listeners and children close.

The packaged proof uses the exact candidate plugin on shared core a7da4314609485e5296de0f5e8a56486122706dd, with rendering/chunking/socket owner identities verified against current source. It is not an exact-main full package build. Earlier direct-source attempts stalled while materializing the broad plugin runtime; diagnostics falsified a suspected delivery-callback stall. Those controller-limited attempts remain recorded, and no callback, runtime check or timeout was bypassed. Existing current-source cancellation controls pass separately.

Release-note context: render IRC replies before splitting so long code examples retain literal characters and fence-only fragments cannot reject the reply.

@steipete steipete self-assigned this Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: irc size: S maintainer Maintainer-authored PR labels Sep 4, 2026
@steipete
steipete marked this pull request as ready for review September 4, 2026 14:35
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 10:45 AM ET / 14:45 UTC.

ClawSweeper review

What this changes

The PR renders each complete IRC reply to plain text before chunking it, adds local TCP regressions for code and links across boundaries, and documents IRC outbound text behavior.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored PR open: current main still chunks raw Markdown before the IRC sender renders it, while this patch moves rendering to the sender boundary and preserves existing reply and receipt flow. No blocking correctness or security finding was identified.

Priority: P1
Reviewed head: 1dbd9bb3f360d87cca549c44407ccffbc3edc38f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative production repair with boundary-level regression coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes before/after local TCP and Gateway-path evidence aligned with the changed IRC sender and wire output.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes before/after local TCP and Gateway-path evidence aligned with the changed IRC sender and wire output.
Evidence reviewed 7 items Current-main failure path: At the PR base, the formatted IRC adapter first split raw Markdown, including a Markdown-aware newline path, and only then passed fragments to the sender; the sender renders each fragment independently.
Owner-boundary repair: The proposed sender now converts the complete trimmed input through table conversion and plain-text Markdown projection before invoking the supplied chunk planner, so code fences and links are parsed as one document.
Caller and delivery integration: The IRC plugin registers the formatted sender on its outbound adapter, and the shared delivery layer dispatches formatted text through that adapter with the prepared channel context.
Findings None None.
Security None None.

How this fits together

The IRC plugin receives formatted agent output through OpenClaw’s channel delivery layer, turns it into IRC-safe plain text, and sends chunked messages with reply references and delivery receipts. This change moves the Markdown-to-text transformation ahead of that chunk planning step.

flowchart LR
  A[Formatted agent reply] --> B[IRC outbound adapter]
  B --> C[Complete plain-text rendering]
  C --> D[Chunk planning and reply fanout]
  D --> E[IRC client]
  E --> F[IRC messages and receipts]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -25, Tests +107, Docs +14. Total +96 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 29 54 -25
Tests 1 107 0 +107
Docs 1 14 0 +14
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 150 54 +96

Review metrics

Metric Value Why it matters
Production versus test delta production +29/-54 (net -25); tests +107; docs +14 The repair removes duplicate fragment-preparation paths while adding socket-boundary coverage for the rendering order.

Technical review

Best possible solution:

Keep complete-message Markdown projection owned by the IRC sender, then plan IRC-sized plain-text chunks while retaining the existing reply fanout, connection, and receipt behavior.

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

Yes — source inspection of current main shows raw Markdown is split before the sender projects it to plain text, and the supplied PR evidence records matching before/after local TCP scenarios. No local test was rerun because this review requires a read-only checkout.

Is this the best way to solve the issue?

Yes — rendering at extensions/irc/src/send.ts is the narrowest owner-boundary repair because that module already owns table conversion and Markdown projection for every IRC send; chunking the resulting plain text avoids fragment parser context loss.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: The pre-fix IRC path can silently lose literal content or reject a nonempty channel reply, affecting a real delivery workflow.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes before/after local TCP and Gateway-path evidence aligned with the changed IRC sender and wire output.

Label justifications:

  • P1: The pre-fix IRC path can silently lose literal content or reject a nonempty channel reply, affecting a real delivery workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes before/after local TCP and Gateway-path evidence aligned with the changed IRC sender and wire output.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RileyJJY: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rendering the complete logical reply before chunking is the correct ownership order. Splitting raw Markdown first guarantees boundary-dependent parser behaviour, especially around fences and inline code, while the plain-text chunker already owns IRC frame planning. The local TCP proof that every resulting frame stays within the 512-byte IRC limit is the key compatibility check here. This also removes the risky “empty rendered chunk” recovery path instead of adding another fence special case.

@steipete
steipete merged commit bf14f76 into main Sep 4, 2026
215 checks passed
@steipete
steipete deleted the codex/qa-irc-render-order-20260904 branch September 4, 2026 15:08
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 4, 2026
…9-prep

* commit '407a8f453c0f0306af1ddc0aafa8697c1d49a9e7': (312 commits)
  perf(ui): coalesce automation event refreshes (#138065)
  fix: reject incomplete Skill Workshop directory reads (#138082)
  test(ui): decouple rendering checks from generated wording (#138283)
  perf: avoid temporary entries in bounded JSON traversal (#138017)
  fix(irc): render complete messages before splitting (#138328)
  perf: prepare worker trajectory payloads only for recorded events (#138086)
  fix(mcp): paginated listings no longer time out after a forward clock step (#137206)
  fix(codex): page native transcripts and bound UI previews (#136282)
  feat(gateway): apply more settings without restarting (#138112)
  fix(docs): preserve mirrored ClawHub maturity links (#138241)
  fix(test): own UI animation and legacy database setup (#138296)
  fix(tts): preserve literal directives in Markdown code (#138319)
  fix: load chat widgets behind authenticated gateways (#138074)
  chore(ui): cover native approval finalization (#137259)
  fix(cron): cancel conditions before main-session handoff (#138313)
  fix(backup): preserve text after embedded NUL characters (#138327)
  fix(android): align composer control sheets (#137442)
  fix(ci): wait for replacement PR runs instead of stale failures (#138307)
  fix(sessions): keep Gateway responsive with long transcripts (#138094)
  fix(computer): map window inputs to delivered image coordinates (#138271)
  ...

# Conflicts:
#	scripts/release-check.ts
#	test/release-check.test.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: irc docs Improvements or additions to documentation maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. 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