Repository navigation
✨ feat(attention): wire per-recipient budget and digest into live delivery - #16426
Conversation
…e ledger Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[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 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Evidence bundle `#16426eb39261` sha256:a0a82550eb1412c37bd35ee166f9848f28e90cf79e5e8bfd324260a6f23d6354 — download from the dashboard or `hivectl review evidence #16426`.Review findings from Read the diff against the v5 tree and the What I verified:
One suggestion, not a defect: the new Two CI checks show CANCELLED ( |
There was a problem hiding this comment.
Read the wiring against pkg/attentionbudget/budget.go and pkg/attention/episodes.go on v5. Looks correct to me; one informational note below, nothing blocking.
What I verified:
- Admit-once on first ping.
deliveronly callsAdmiton the!needFindbranch (episodes.go:552-566), beforee.Attemptis set. The retry path (Attempt != ""→Find→ not found → fall through toPost) is never re-admitted, matching the body. An Overflow returns beforeAttemptis assigned, so the episode staysWouldNotifyand is re-offered on the nextReport. - Over-budget semantics match the package.
Budget.Admit(budget.go:260-309) delivers aPingfor a recipient not opted into the digest even when over budget; only reminders and digest opt-ins overflow. So "never dropped" holds: the overflowed ask sits inb.openuntilResolve, andreleaseBudgetis called from every terminal transition (ack.go:169,reminder.go:88,Update, andrecordono.Resolved). - Seed respects exemptions.
Seed(budget.go:211-222) skips exempt classes and empty recipients, anddeliveredWritesmaps emptyClasstoPing/Reminderbefore seeding, so historical security/hold pages won't consume budget once producers tag them. - Reminder gating order.
remindAttentionconsultsWritebackAllowedfirst, thenAdmitReminder, then posts (attention_queue.go:210-222).errAttentionOverflowis counted separately fromErrSuppressedin the sweep, not surfaced as an error. - Digest gate kind (
KindIssueFile,HiveAuthored: true) matches whatsyncAttentionQueueIssuealready uses for the tracking issue atattention_queue.go:295. - Locking:
Budgethas its own mutex and never calls back intoStore, soAdmitunders.mu(indeliverandAdmitReminder) can't deadlock.
Info (not a defect of this PR): no production caller of ReportAttention exists on v5 yet (only pkg/github/attention.go:31 defines it), so nothing sets Observation.Class today. When producers are wired, security / required-review / hold notices must set the exempt class or they will be budgeted like ordinary pings. Worth a line in attention-episodes.md if it isn't already there.
Only tide is pending.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #16271
Part of #16075 (epic; other children remain)
Why
#16309 landed the store-agnostic
pkg/attentionbudgetpackage, but it held off on wiring it into live non-urgent posts and on loading its keys fromgithub.attention. At that point the condition-episode store (#16267) was still an open contributor PR, and touching it would have caused conflicts. That store has now landed on v5 (pkg/attention,github.attentioninconfig.go,pkg/github/attention.go), so this PR does the remaining wiring. The budget package API is used as it is, with no redesign.What
attentionbudget.Configis embedded inline inattention.Config, sogithub.attention.recipient_budgetandgithub.attention.digest_recipientsload from yaml.attention.Config.Validate()calls itsValidate(), andconfig/validate.goalready runs that. The settings-parity walker now also collectspkg/attentionbudget, and both keys are on the yaml-only allowlist.pkg/attention):Store.Openseeds the budget from the ledger's delivered history (paged_to/paged_atplus the last reminder).Store.delivercallsAdmitbefore each fresh first-ping POST. Retries of an uncertain attempt are not admitted a second time.Store.AdmitReminderdoes the same check for reminders.overflowed, it stays in the attention queue, and it is retried on later passes. Ack, snooze and resolve clear it throughBudget.Resolve.Observation.Classmarks exempt asks (security,required_review,protocol_command,hold), and these always deliver. An unset class is an ordinary non-urgent ping.remindAttentionadmits each reminder after the writeback check. Overflow is counted inAttentionQueueResult.Overflowedand is not treated as an error. When the budget is enabled, the item status card gets theattention-overflowsection (RenderSection). Opted-in recipients get their single digest comment on the repo's attention queue issue throughattentionbudget.UpsertDigestand the existingUpsertIssueMarkerCommentboundary, behind a writeback check. Each sweep logs the shadowattention budget:line (LogLine).recipient_budget: 0, every decision isDeliverand no extra API calls are made. The only difference is the shadow tally and its log line.notifications.md,attention-episodes.md) and changelog fragmentchanged-16271-attention-budget-wired.md.Tests
pkg/attention/budget_test.go:would_overflowis reported.Overflowed,RenderSectionand the digest, is not double-posted, and is cleared on resolve./hive ackclears it.attention.Config.Validate.pkg/config/github_attention_budget_test.go: the keys load from thegithub.attentionyaml, default to off, and are validated.internal/settingsparity: the new leaves are enumerated.I did not run anything locally, per AGENTS.md. CI is the verdict.
— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@hanthor