Repository navigation
improve(irc): reuse transient connection for chunked sends - #128487
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 1:34 AM ET / 05:34 UTC. ClawSweeper reviewWhat this changesThe PR sends all chunks from one formatted IRC outbound operation through one transient IRC connection instead of reconnecting for every chunk. Merge readinessThe patch is source-correct and retains the IRC plugin as the connection-lifecycle owner, but this maintainer-labeled PR needs an explicit availability-risk decision before merge. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherShared outbound delivery prepares formatted text and passes it to the IRC plugin. The plugin projects chunks and reply fanout, sends them through an IRC client, and returns delivery results to the shared delivery layer. flowchart LR
A[Prepared outbound text] --> B[IRC formatted send]
B --> C[Chunk and reply projection]
C --> D[Transient IRC connection]
D --> E[IRC server]
E --> F[Delivery results]
Decision needed
Why: The PR changes an availability boundary and carries the protected maintainer label, so a human should weigh the measured performance gain against the remaining fault-injection evidence gap. Before merge
Agent review detailsSecurityNone. PR surfaceSource +111, Tests +142. Total +253 across 5 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the plugin-owned, operation-local connection design and either capture a real loopback peer-disconnect trace or explicitly accept the focused mock coverage before merge. Do we have a high-confidence way to reproduce the issue? Yes in source: current main reconnects once per IRC chunk send, while this PR supplies one formatted operation that reuses its client. Is this the best way to solve the issue? Yes: the IRC plugin owns the prepared outbound operation, avoiding a core special case, raw-client behavior change, or cross-operation cache. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1ece62a4d807. LabelsLabel 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
History |
|
Land-ready disposition for exact head Root cause and best fix Core prepared a long IRC text as N chunks, while each adapter call independently opened, authenticated, joined, sent, and quit a transient IRC connection. The channel-owned formatted-send seam is the narrow owner that knows those chunks are one outbound operation, so it now projects canonical chunk/reply fanout once and sends all chunks through one operation-local client. A cross-send cache was rejected because it adds connection lifetime/concurrency/invalidation state; raw-client batching was rejected because that layer owns IRC protocol line limits rather than outbound operation semantics; a core IRC special case was rejected because provider transport ownership belongs in the plugin. Production LOC: +149/-45 (net +104) | Tests: +101/-2. The positive production delta implements the formatted-operation owner, canonical chunk/reply/lifecycle parity, and abort-aware transient connection setup without public/config/protocol/storage state. ClawSweeper disposition The review finding on prior head
The current-head follow-up is limited to that finding and its focused test. Final changed-file gates passed, and fresh TruffleHog plus Codex Proof
Provenance
Remaining proof gap: no credentialed external IRC send was performed. The retained deterministic loopback exercised the real socket/client boundary, including connection count, ordered wire payloads, and cancellation cleanup. |
|
Final maintainer disposition for exact head ClawSweeper's recommended availability option—require a real loopback peer-disconnect proof—was selected and completed. The alternative to accept mock-only coverage was not used. Real peer-disconnect trace A temporary, source-hash-recorded Vitest proof used the actual Node TCP boundary, actual
This closes the exact merge-risk question without adding reconnect/resend behavior: a prior Final evidence
No credentialed external IRC mutation was performed. The deterministic real socket/client loopback now covers both successful batching and peer-disconnect suffix suppression at the transport boundary. |
|
Merged via squash.
|
…128487) * perf(irc): reuse transient connection across chunks Amp-Thread-ID: https://ampcode.com/threads/T-01a02f9f-3359-7327-bff0-6a4f85f666b7 * fix(irc): honor cancellation during connect * fix(irc): stop chunk fanout after disconnect --------- Co-authored-by: Amp <[email protected]>
Summary
Root cause
Core chunks a long ordinary IRC message before transport. The prior IRC adapter called
sendTextonce per chunk, and every call independently connected, authenticated, joined, sent, and quit. A three-chunk message therefore paid three complete connection handshakes even though the chunks belonged to one prepared outbound operation.The fix keeps canonical IRC chunk mode, text limit, reply fanout, Markdown/table projection, and the raw client's independent 512-byte line enforcement, while batching only the already-related text chunks through one transient client.
No cache, public SDK, config, protocol, security, storage, media, or retry/idempotency behavior changes.
Why this boundary
sendFormattedTextalready represents one prepared outbound operation and is the narrow owner that can reuse one transient connection without crossing message boundaries.Verification
check:changedpassed formatting, production/test types, type-aware Oxlint (0 findings), dead exports, boundaries, guards, and import cycles.git diff --checkpassed.gpt-5.6-solhigh autoreview found no issue (0.98 correct).922d58803db12ae191b3c0b4ccd8b18ee1e99d95.Frozen loopback proof used a 15 ms welcome delay and 12 ordinary three-chunk sends with explicit reply fanout:
e21d1a7b929d819735632b349721f76d1a49513bddd94bc64a4448a18c192190No live credentialed IRC provider mutation was performed; the retained loopback server exercised the real socket/client boundary.