Repository navigation
Conversation
A peer that never sends LF could grow the IRC client buffer without bound. Complete lines and the pending record now use the same 512-byte wire limit as outbound PRIVMSG, then the socket closes. Signed-off-by: Sebastien Tardif <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 29, 2026, 1:38 PM ET / 17:38 UTC (Revision 4). ClawSweeper reviewWhat this changesThe IRC plugin closes connections on oversized inbound lines, notifies its reconnect monitor after registration, and adds loopback socket regression tests. Merge readiness⛔ Blocked before merge - 3 items remain The current main branch still has an unbounded IRC receive buffer, and this PR addresses it with credible production-path proof. The remaining merge choice is whether disconnecting on every line over 512 bytes is acceptable for existing IRC connections. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s IRC plugin reads server data from a TCP or TLS socket, parses lines, and passes accepted messages to the channel monitor. The monitor manages reconnects and subsequent message delivery. flowchart LR
A[IRC server bytes] --> B[IRC client buffer]
B --> C{Line within limit?}
C -->|Yes| D[Parse IRC message]
D --> E[Channel monitor]
C -->|No| F[Close socket]
F --> G[Reconnect monitor]
Decision needed
Why: The bound prevents unbounded memory retention but intentionally changes connection behavior for servers that send longer lines; the contributor’s disclosure is not an owner decision. Before merge
Agent review detailsSecurityNone. PR surfaceSource +21, Tests +191. Total +212 across 2 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: Keep the bounded IRC receive path and reconnect notification, then document the line-limit behavior once the IRC owner confirms the tradeoff. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main appends unterminated IRC data without a bound. The contributor also supplied before-and-after loopback observations; this review did not execute the PR code. Is this the best way to solve the issue? Yes for the memory-retention defect: bounding the client’s receive buffer and notifying its existing reconnect owner is a narrow repair. The disconnect policy for longer server lines still needs owner acceptance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 16b17b22ebc1. LabelsLabel changes: No label 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 (3 earlier review cycles)
|
…ient failAndClose marks the socket closed before destroy, so the close listener never runs. After registration, report that disconnect once so the channel monitor can reconnect. Before registration, and on quit, leave the callback silent. Signed-off-by: Sebastien Tardif <[email protected]>
|
This pull request has been automatically marked as stale due to inactivity. |
|
Thanks @SebTardif for identifying the unbounded receive buffer and adding socket regression coverage. This is already addressed on main by #165018, merged as 0ac81cf6ec1a93acad4abe7e57bd8fe7537afa23. I verified that current main still bounds both complete and unterminated records, clears the buffer and destroys the socket on overflow, and reports disconnect through the existing reconnect path. Its 16,384-code-unit framing ceiling leaves room for IRCv3 tags instead of applying the outbound 512-byte limit to the entire inbound record. Closing as already fixed; thank you for the report and tests. |
What Problem This Solves
The IRC client already refuses to send a line longer than 512 bytes. Inbound bytes were different. Socket data was appended until a line feed arrived, with no maximum. A peer that never sends LF keeps that buffer until the process runs out of memory.
Complete lines and the still-pending record are now measured in UTF-8 bytes. More than 510 bytes of payload (512 including CRLF) reports
IRC inbound line exceeds the 512-byte limitand destroys the socket. A legal 512-byte line, including one split across two writes, still parses, and PING still receives PONG.Closing the socket from this limit sets the closed flag before the socket emits close. The close listener therefore never runs. After registration, the client now calls the disconnect callback once so the channel monitor can reconnect. Before registration, and on an ordinary quit, that callback stays silent.
This client does not parse IRCv3 message tags. A server that sends a tagged line over 512 bytes will be disconnected. That is the same wire cap already used for outbound PRIVMSG.
Pull request 107376 added this bound earlier and was closed by its author on 2026-07-19. The unbounded buffer is still on main. There is no open issue for this defect.
Evidence
Terminal output from production
connectIrcClientagainst a loopback TCP server on 127.0.0.1. Node v26.9.0. The command ran in the patched tree and is not part of the diff.Before the bound, the same unterminated 1 MiB write left the socket open for more than one second. Before the disconnect callback, a registered client closed on that write without notifying the monitor.
After the bound and the disconnect callback:
Real behavior proof