Repository navigation
Closed
Labels
agent/scannerCreated or modified by the scanner agentCreated or modified by the scanner agenthelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.
Description
Part of #15869
Goal
Add one Discord thread per RFC in the existing text channel. A durable per-RFC mapping (message ID and thread ID) makes announcements idempotent and allows crash/retry reconciliation. Later lifecycle events post into the thread. An opt-in GitHub backlink is posted at most once, and only after the thread exists.
Applicable decision constraints
- Keep the existing text channel and create one thread per RFC. No Forum migration.
- One explicitly designated announcer per destination (the
rfc_announcergate from [scanner] Add opt-in rich RFC notify config, designated-announcer gate and private-repo gate #15926) with durable idempotency and reconciliation. Channel-history scanning is not an atomic distributed claim. - An optional history lookup may reconcile crash/retry uncertainty, but must not trigger unbounded backfill or duplicate announcements.
- Backlinks are opt-in (
rfc_backlink_comment) and posted at most once, only after the Discord thread is confirmed. No automatic comments on others' issues by default. - Bound retries, respect rate limits, surface failures. No historical announcement burst.
Current code (v5)
src/pkg/rfcnotify/detector.go:issueRecord{Open, Held, Actionable, ReadyAnnounced, LastSeen}lives inState(stateVersion = 1).Detector.Savepersists it atomically to/data/rfc-notify.json.clone/rollbackundo unposted events.src/pkg/rfcnotify/sweeper.go:Sweeper.Runposts in order and stops the batch on the first failure.src/pkg/discord/bot.go:SendMessageTo(+SendEmbedTofrom [scanner] Render RFC notices as summary-card embeds when rfc_format: card #15927). There is no thread API.src/cmd/hive/rfcnotify_wire.gobuilds the poster.github.Client.CreateIssueCommentandCreateIssueCommentBudgetedalready exist.
Changes
- Extend
issueRecordwithMessageID,ThreadID,Nonce,AnnounceState(""|pending|posted|threaded) andBacklinkPosted. BumpstateVersionto 2 and load v1 files unchanged. - Write-ahead intent. Before posting an "opened" card, record
AnnounceState=pendingwith a deterministic nonce (a hash of repo#number + "opened", ≤25 chars) andSave. Send with Discord'snonce+enforce_nonce: true, so a retry inside Discord's dedup window returns the same message. On success, storeMessageIDand save. - Thread. Add
StartThreadFromMessage(channelID, messageID, name string) (threadID string, err error)tobot.go(POST /channels/{c}/messages/{m}/threads, name#Nplus the RFC title truncated to 100 chars). StoreThreadIDand set the state tothreaded. Later events for the RFC post intoThreadID; threads are channels, soSendMessageTo/SendEmbedTowork. Closed and ready events also echo one line to the parent channel. - Reconciliation. This runs at startup, or when a record is
pending/postedwithout a thread. Do one bounded lookup of the channel's last ≤50 messages (GET /channels/{c}/messages?limit=50, a newbot.gohelper) for a message from this bot with a matching nonce or issue URL. If one is found, adopt it. If not, and the record is stillpending, re-post once with the same nonce. Never scan further back, and never reconcile records created before the watermark, so there is no backfill. History lookup is only for this recovery, never a claim between hives. - Backlink. When
Backlinkis set and the state isthreaded, postDiscussion thread:followed by the thread URL once withCreateIssueCommentBudgeted, then setBacklinkPostedand save. On failure the flag stays unset. Retries are bounded (e.g., 3 attempts tracked in the record), then a warning is logged. - Rate limits. Every new bot call honours the 429
retry_afterwith a bounded retry. Failures go toResult.Errors, the existinglogger.Warn, and the audit line inrunRFCNotifySweep.
Decision taken by hive: idempotency uses Discord enforce_nonce plus a write-ahead record, not a hub lock. The decision designates a single announcer, so the only race left is a crash or retry inside one hive.
Files
src/pkg/rfcnotify/detector.go,src/pkg/rfcnotify/sweeper.go(+ newsrc/pkg/rfcnotify/thread_test.go)src/pkg/discord/bot.go(+httptesttests for thread create, the nonce payload, message lookup and 429 handling)src/cmd/hive/rfcnotify_wire.go(thread and backlink adapters)
Acceptance
- On the announcer with
rfc_threads: true, opening an RFC posts one card and starts one thread. Closing it posts into the thread and echoes one line to the channel. - If the hive crashes between the post and the thread creation, the restart attaches the thread to the existing message and posts no second card.
- A restart neither re-posts nor loses the mapping (covered by a v1 → v2 state load test).
- The backlink is posted only when enabled, only after the thread ID is confirmed, and at most once across restarts.
- A hive that is not the announcer never calls the Discord API in rich mode.
rfcnotifycoverage stays ≥ 90 (the default floor) anddiscordmeets itsPKG_THRESHOLDentry. Addchangelog.d/added-rfc-notify-threads.mdand update the docs insrc/docs/notifications.md.
— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88
Metadata
Metadata
Assignees
Labels
agent/scannerCreated or modified by the scanner agentCreated or modified by the scanner agenthelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.
Activity
hivecommons-hive commentedon Oct 31, 2026
🔒 Claimed by @Karibhou (contributor on hive hosted-available-oke-11-placeholder-r05x). The claim lasts 30m0s without activity and renews while the work continues. Reply
/unclaimto release, or/claimto take it over if you outrank the holder.hivecommons-hive commentedon Oct 31, 2026
🔓 Claim by @Karibhou released (released on disconnect).
hivecommons-hive commentedon Oct 31, 2026
🔒 Claimed by @Karibhou (contributor on hive hosted-available-oke-11-placeholder-r05x). The claim lasts 30m0s without activity and renews while the work continues. Reply
/unclaimto release, or/claimto take it over if you outrank the holder.hivecommons-hive commentedon Oct 31, 2026
🔓 Claim by @Karibhou released (lease revoked).
✨ feat(rfcnotify): one Discord thread per RFC with durable idempotent…
✨ feat(rfcnotify): one Discord thread per RFC with durable idempotent…