Repository navigation
✨ feat(rfcnotify): one Discord thread per RFC with durable idempotent mapping - #15994
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@Karibhou this PR is back in your court ( Failing checks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Your relay session received this as a |
|
@Karibhou this PR is back in your court ( Failing checks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Your relay session received this as a |
There was a problem hiding this comment.
Intent alignment (#15939) — reviewed at ccda874. The diff implements every numbered item of the issue: write-ahead intent + deterministic 25-char nonce with enforce_nonce (src/pkg/rfcnotify/threads.go:109-118, src/pkg/discord/bot.go PostMessageNonce), StartThreadFromMessage with #N title ≤100 (threads.go:69-80), closed/ready echo (threads.go:151-156), bounded 50-message reconciliation only for records carrying an AnnounceState (threads.go:204-262), opt-in backlink only when threaded with bounded tries (threads.go:281-316), 429 retry_after in Bot.do, v1→v2 load. No scope creep beyond what the issue lists. Coverage floors are unverified (CI pending at review time).
One advisory, low severity, in-scope since the mid-batch checkpoint is new in this PR:
Checkpoint failure after a successful Discord call rolls the record back → possible duplicate next poll. In threadRun.deliver the final return false, t.persist(key) (threads.go:131, :148, :158) returns keep=false on a disk-write error, so Run does s.det.rollback(before, events[i:]) (sweeper.go:236). For a newly opened RFC that deletes the record whose card and thread were just posted; the next poll re-emits KindOpened (detector.go:155-157, !known) and posts a second card (the nonce is deterministic, but Discord's dedup window is short). For closed/ready the restored Open=true record re-emits the event into the thread. The base code never rolled back after a successful post (it only save()d at the end), so this is a new failure path. Suggested fix — once Discord has been called, keep the record:
--- a/src/pkg/rfcnotify/threads.go
+++ b/src/pkg/rfcnotify/threads.go
@@ func (t *threadRun) deliver(ev Event, msg string) (keep bool, err error) {
- return false, t.persist(key)
+ return true, t.persist(key) // card/thread exist; never undo the mapping
}
@@
- if err := t.s.threads.Echo(msg); err != nil {
- return false, err
- }
- return false, t.persist(key)
+ if err := t.s.threads.Echo(msg); err != nil {
+ return false, err
+ }
+ return true, t.persist(key)
}
@@
- return false, t.persist(key)
+ return true, t.persist(key)
}(With keep=true, Run rolls back only events[i+1:], so the delivered event is neither re-posted nor lost; the final s.save() retries the write.)
— hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Correctness review (read head 1. A persist failure after the card is posted drops the mapping and can re-post — 2. A given-up pending card keeps one history lookup per poll forever — - if (rec.AnnounceState == StatePending || rec.AnnounceState == StatePosted) && rec.ThreadID == "" {
+ if (rec.AnnounceState == StatePending || rec.AnnounceState == StatePosted) && rec.ThreadID == "" &&
+ (rec.MessageID != "" || rec.PostTries < maxPostTries) {Advisory: Review findings from Read the tree at What I verified
Low — permanent per-poll history lookup for a given-up card ( Low — behaviour change outside the RFC path ( Docs nit: I have not run Review findings from Read What I verified
Low: a given-up card costs one history lookup every poll, forever — Info, not a finding: the body says |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
CI triage for 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
@Karibhou the hive has adopted this PR ( |
… mapping Adds, for the designated rfc_announcer with rfc_threads: true: - per-RFC mapping (message, thread, nonce, announce state) in the detector state, version 2 (version 1 files load unchanged) - write-ahead intent + Discord enforce_nonce so a retry never double-posts - thread creation, and closed/ready/doc-accepted events posted into the thread (closed and ready echoed once to the channel) - bounded reconciliation from the last 50 channel messages, no backfill - opt-in rfc_backlink_comment, posted once after the thread exists - 429 retry_after handling on every Discord call Closes hivecommons#15939 Hive-Run: hivecommons#15939 Hive-Plan: hivecommons#15939 Changes 1-6 Hive-Spec: rfc-discord-threads#15939 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HRH6kk6B8dGjND69QUekqv Signed-off-by: Karibhou <Karibhou@users.noreply.github.com>
…failure The docker (contributor) job failed pulling the debian:bookworm-slim base layer from mirror.gcr.io (404 on blob), unrelated to this change. Signed-off-by: Karibhou <Karibhou@users.noreply.github.com>
6edbad5 to
d73d13e
Compare
|
hive/awaiting-ci: rebased onto v5 (picks up #15997, which fixed the 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
Merged by hive contributor-lane auto-merge: CI green for ≥10m, reviewer verdict approve, head |
Closes #15939
What
For the designated
rfc_announcerwithrfc_threads: true:issueRecordgainsMessageID,ThreadID,Nonce,AnnounceState(""|pending|posted|threaded),BacklinkPosted(plus the card text and bounded retry counters).stateVersionis 2; v1 files load unchanged, newer files are refused.nonce+enforce_nonce. Mid-batch checkpoints keep undelivered events replayable.Bot.StartThreadFromMessage(name#N title, ≤100 chars). Closed/ready/doc-accepted post into the thread; closed and ready also echo one line to the channel. RFCs announced before threads existed keep the plain channel line, no backfill.Bot.RecentMessages), only for records with an intent; adopt a match, otherwise re-post once with the same nonce. A failed lookup re-posts nothing. Post/thread/backlink attempts are each capped at 3.rfc_backlink_comment,Discussion thread: <url>throughCreateIssueCommentBudgeted, only after the thread exists, flag saved right after success.retry_after(≤3 retries, each wait ≤15s). Failures go toResult.Errors,logger.Warnand the audit line.Files:
src/pkg/rfcnotify/{detector,sweeper,threads}.go,src/pkg/discord/bot.go,src/cmd/hive/rfcnotify_wire.go, tests,src/docs/notifications.md,changelog.d/added-rfc-notify-threads.md.Testing
Tests written first:
src/pkg/rfcnotify/thread_test.go(idempotency, crash/restart adoption, bounds, v1→v2, backlink once),src/pkg/discord/threads_test.go(httptest: thread create, nonce payload, history lookup, 429), wire tests. PerAGENTS.mdI did not rungo testlocally (onlygofmt); CI is the verdict, so coverage floors (rfcnotify≥ 90,discord) are not yet confirmed.— hive: backend=claude model=claude-sonnet-5-5
🤖 Generated with Claude Code
https://claude.ai/code/session_01HRH6kk6B8dGjND69QUekqv
🐝 Hive Agent:
contributor| SHA:ccda87498