feat: labeled-response (optimistic outgoing messages)#183
Conversation
Implements the IRCv3 labeled-response capability so we can show a
sent message immediately in its destination buffer with a "pending"
indicator, then let the server's echo authoritatively replace it
with the real msgid / content / nick once it arrives. Mostly visible
on slow connections, where the placeholder gives instant feedback
without losing the safety net of waiting for the server to confirm.
Wire-protocol bits:
- labeled-response added to ourCaps so the cap is auto-requested
when the server advertises it (depends on `batch`, also in caps).
- lib/labeledResponse.ts: makeLabel() + withLabel(prefix, label),
returning a tag-prefix string that composes cleanly with the
existing `+reply=` / `+draft/reply=` prefix path.
- useMessageSending sends `@<existing-tags>;label=<id> PRIVMSG ...`
when both `labeled-response` and `echo-message` are negotiated.
Without echo-message there's no echo to acknowledge the placeholder
so we keep the legacy code path; whispers also keep their existing
flow because they don't have a 1:1 echo match.
State:
- Message gains optional `pendingLabel` and `status` ("pending" |
"failed"); regular received messages have neither field, so
nothing changes for them.
- Two new store actions: confirmPendingMessage(serverId, bufferId,
label, updates) replaces the placeholder in place when the echo
arrives, returning false on miss so callers can fall back to
addMessage; failPendingMessage flips the status when the
PENDING_TIMEOUT_MS (30s) timer fires.
- CHANMSG, USERMSG (regular and multiline own-echo branches) now
consult confirmPendingMessage before falling through to
addMessage when mtags.label is present and the sender is the
current user. msgid is recorded in processedMessageIds so any
duplicate-echo guards keep working.
UI:
- MessageItem applies opacity-60 + italic for status === "pending"
and opacity-60 + line-through + red text for "failed". The
rest of the row layout is unchanged so the placeholder simply
"settles" into place when the echo lands.
Tests:
- ChatArea test mock now stubs hasCapability(); useMessageSending
calls it to gate the label path.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Automated deployment preview for the PR in the Cloudflare Pages. |
| // labeled-response: when the user sends a message with the | ||
| // labeled-response cap acked, we insert a local placeholder | ||
| // immediately and wait for the server's echo to match it back. | ||
| // `pendingLabel` is the label tag value we attached on send, set | ||
| // only on the local placeholder until the echo arrives. | ||
| pendingLabel?: string; | ||
| // labeled-response: lifecycle state of an outgoing message. | ||
| // - "pending": placeholder awaiting server echo | ||
| // - "failed": no echo / FAIL arrived in the timeout window | ||
| // undefined => normal received message (no pending lifecycle). |
There was a problem hiding this comment.
too many comments jesus
# Conflicts: # src/lib/irc/IRCClient.ts
# Conflicts: # src/lib/irc/IRCClient.ts
Implements the IRCv3 labeled-response capability so we can show a sent message immediately in its destination buffer with a "pending" indicator, then let the server's echo authoritatively replace it with the real msgid / content / nick once it arrives. Mostly visible on slow connections, where the placeholder gives instant feedback without losing the safety net of waiting for the server to confirm.
Wire-protocol bits:
batch, also in caps).+reply=/+draft/reply=prefix path.@<existing-tags>;label=<id> PRIVMSG ...when bothlabeled-responseandecho-messageare negotiated. Without echo-message there's no echo to acknowledge the placeholder so we keep the legacy code path; whispers also keep their existing flow because they don't have a 1:1 echo match.State:
pendingLabelandstatus("pending" | "failed"); regular received messages have neither field, so nothing changes for them.UI:
Tests: