Repository navigation
✨ feat(notifications): shadow-mode would-notify instrumentation and write-site classification - #16321
Conversation
…rite-site classification 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 `#1632187d2118` sha256:a9de5d99e2e746c5d1a87d039d74c1d58743982bee2ee92e5e11d6bf78899261 — download from the dashboard or `hivectl review evidence #16321`. |
There was a problem hiding this comment.
Read notification_shadow.go, the tally change, and every record site; the instrumentation is correct and genuinely behaviour-free, but the PR is red on one mechanical doc-citation drift.
Blocking (mechanical): the failed relative links and anchors resolve check is the citation step, not the link step (links pass locally on db345f5). Log: DRIFT src/docs/scale-envelope.md:37 src/pkg/github/client.go:5040-5050 -> lacks anchor(s) near cited range: AgeMinutes. Cause: the five new Client fields at src/pkg/github/client.go:281-285 (shadowNotificationsFn, notificationShadow) shift everything below them. Fix: python3 src/scripts/check-docs-citations.py --fix and commit the rewritten range.
What I verified
- Off path is a true no-op:
recordNotificationWritereturns before any work whenshadowNotificationsFnis nil/false (notification_shadow.go), andmain_sweeps.goreadscfg.GitHub.Notifications.Shadowlive. - No lock-order hazard:
notificationShadow.recordandnoteShadowSuppressedreleases.mubeforenotificationShadowLogAttrs()re-acquires it;maybeLogis still hourly-throttled so the extra call inrecordNotificationWritecannot flood the log. - Memory is bounded: 512-record ring,
conditions/itemsmaps pruned at 20k keys by age then by count. - Prometheus cardinality is bounded to
{hive_id, producer, class}; mentioned/requested logins stay in the in-memory ring (capped at 10 per record) and are not exported (metrics_github_notifications.go). - No textual conflict with #16319:
git merge-treeof the two heads is clean; this PR's one-line change inpr_status_comment.gois inPostNoteOrFold, which #16319 does not touch.
One open question, not a defect: in review_request_watcher.go the non-revise branch sets reviewSubmitted = true before effects.ExecuteReconciling. If the effects boundary short-circuits a replayed claim without calling CreateReview, the record counts a review that was not written. For shadow-mode measurement that is an over-count, not a behaviour change, so I have not weighted it; worth a glance if exact per-active-item ratios matter.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> # Conflicts: # src/docs/scale-envelope.md
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
v5 renamed QueuePRAutoMergeWithNoteResult -> QueuePRAutoMergeWithNoteResultAtHead and moved the operator-approval write into reportOperatorPullRequestApproval, so TestNotificationWriteSitesInventory flagged both as drift. Update the inventory and the docs table to the new symbol names. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
…rect-write ratchet Merging v5 (#16319, #16321) moved the hive status comment's edit/create/ delete into prstatus.Forge adapters in automerge_stage_labels.go and pr_status_comment.go without updating the write-back ratchet, so TestDirectWriteRatchet failed on every PR's merge commit. Mark the forge adapter calls writeback:gated — they are plumbing under prstatus.Write and the write-back decision lives at the ratcheted entry points — and lower the automerge_stage_labels.go baseline now that the old in-place edit is gone. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
…rect-write ratchet Merging v5 (#16319, #16321) moved the hive status comment's edit/create/ delete into prstatus.Forge adapters in automerge_stage_labels.go and pr_status_comment.go without updating the write-back ratchet, so TestDirectWriteRatchet failed on every PR's merge commit. Mark the forge adapter calls writeback:gated — they are plumbing under prstatus.Write and the write-back decision lives at the ratcheted entry points — and lower the automerge_stage_labels.go baseline now that the old in-place edit is gone. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
…us-comment forge create TestNotificationWriteSitesInventory (v5, #16321) flags two untagged notification-capable writes on this branch's merge commit: attentionDelivery.Post, this PR's condition-episode page (attention), and clientStatusForge.CreateComment from #16319's status writer (status, passthrough to its caller). Tag both and mirror the rows in src/docs/notifications.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
v5 went red after #16319 and #16321 landed together: the prstatus forge adapters added raw/wrapper comment writes in pr_status_comment.go and automerge_stage_labels.go that TestDirectWriteRatchet had no baseline for, and clientStatusForge.CreateComment is a new CreateIssueComment call site TestNotificationWriteSitesInventory requires a class tag for. Record the moved status-comment writes in the ratchet baseline, and inventory clientStatusForge.CreateComment as a status passthrough (attributed to the UpsertPRStatusSection / PostNoteOrFold caller), with the matching row in docs/notifications.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
…16310) * 🐛 fix(agent): add hysteresis to the transcript scan overrun warning Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * fix(agent): marginal scan passes break the slow streak without re-arming Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 📝 docs(agent): document transcript_scan_slow debounce; hoist took in refreshTranscriptActivity Address review findings on #16310: the fleet-report class table now describes the once-per-episode / 3-consecutive / 80% re-arm behavior so operators can interpret the ≥5-in-10-min threshold. Compute took once so the judged and logged durations match, and rename the pace parameter to match its type and the tests. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 🧪 test(ci): reconcile write ratchets with the prstatus status writer v5 went red after #16319 and #16321 landed together: the prstatus forge adapters added raw/wrapper comment writes in pr_status_comment.go and automerge_stage_labels.go that TestDirectWriteRatchet had no baseline for, and clientStatusForge.CreateComment is a new CreateIssueComment call site TestNotificationWriteSitesInventory requires a class tag for. Record the moved status-comment writes in the ratchet baseline, and inventory clientStatusForge.CreateComment as a status passthrough (attributed to the UpsertPRStatusSection / PostNoteOrFold caller), with the matching row in docs/notifications.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --------- Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ✨ feature: persist single-admitter condition episodes Add opt-in per-repo attention ownership, durable producer-independent episodes, quiet baseline recovery, and exact-attempt reconciliation before uncertain POST retries. Keep existing writers, reviews, commands and holds unchanged for the separate pilot. Hive-Run: #16267 Hive-Plan: RFC-16075/phase-3-condition-episodes Hive-Spec: RFC-16075#2 Signed-off-by: mendezr <mendezr@users.noreply.github.com> * 🐛 fix: align attention rollout with CI contracts Signed-off-by: mendezr <mendezr@users.noreply.github.com> * 🧪 test: cover attention recovery and fail-closed transitions Signed-off-by: mendezr <mendezr@users.noreply.github.com> * 🐛 fix: page never-delivered conditions on first report, prune resolved episodes Address review findings on #16291: - Baseline only conditions whose key appears in trusted attention delivery history. A never-paged condition on a never-seen item now notifies on its first report instead of being permanently swallowed; History remains the replay guard after ledger loss. Drop the empty-inventory baseline contract from the adapter/doc comments and docs. - Only hive:attention markers with an attempt ID count as delivery history. Status-card hive:condition markers (emitted for non-admitter and never-paged episodes) no longer seed baselines that would suppress a first page. - Prune resolved, reconciled episodes once the flap window has passed so the 4096-episode cap bounds live inventory instead of becoming a dead stop. Uncertain episodes and history-seeded baselines are retained. Tests cover first-report paging, condition-marker-only history, and pruning. Signed-off-by: Andrew Anderson <andy@clubanderson.com> * 📝 docs: link attention episodes page, separate top-level decls Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 🐛 fix: reconcile uncertain resolved episodes, page first reopen, prune items Hive-Fix-Attempt: 2/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 🌱 chore(writeback): annotate status-comment forge plumbing for the direct-write ratchet Merging v5 (#16319, #16321) moved the hive status comment's edit/create/ delete into prstatus.Forge adapters in automerge_stage_labels.go and pr_status_comment.go without updating the write-back ratchet, so TestDirectWriteRatchet failed on every PR's merge commit. Mark the forge adapter calls writeback:gated — they are plumbing under prstatus.Write and the write-back decision lives at the ratcheted entry points — and lower the automerge_stage_labels.go baseline now that the old in-place edit is gone. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 🌱 chore(notifications): inventory attentionDelivery.Post and the status-comment forge create TestNotificationWriteSitesInventory (v5, #16321) flags two untagged notification-capable writes on this branch's merge commit: attentionDelivery.Post, this PR's condition-episode page (attention), and clientStatusForge.CreateComment from #16319's status writer (status, passthrough to its caller). Tag both and mirror the rows in src/docs/notifications.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * fix(attention): mark acknowledged reopen quiet Hive-Fix-Attempt: 3/6 Signed-off-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 🐛 fix: expire stale history baselines and report status-comment writes as ungated Hive-Fix-Attempt: 4/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 📖 docs: list attention-episodes.md in the documentation map and docs README Closes #16330 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 🌱 chore(settingsparity): collect pkg/attention so github.attention leaves are enumerated Closes #16331 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 🌱 chore: retrigger CI after transient npm registry outage build/docker jobs failed in the Dockerfile cline install step with "No matching version found for @ai-sdk/openai@4.0.108"; the version is present on the registry, so this was a transient fetch failure. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --------- Signed-off-by: mendezr <mendezr@users.noreply.github.com> Signed-off-by: Andrew Anderson <andy@clubanderson.com> Signed-off-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: mendezr <mendezr@users.noreply.github.com> Co-authored-by: Andrew Anderson <andy@clubanderson.com> Co-authored-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ier (#16300) * ✨ feat(config): stage bounded human-merge pin-only policy and classifier Implement the shared foundation from #16262 for #16242 without loosening any merge admission gate. Carry complete patch evidence, reject unsupported or mixed diffs, and make the remaining trust, review and exact-head obligations explicit. Hive-Run: #16242 Hive-Plan: ordered-children/16262-config-and-classifier Hive-Spec: issue-16242#required-behavior Co-authored-by: hanthor <5840441+hanthor@users.noreply.github.com> Signed-off-by: mendezr <mendezr@users.noreply.github.com> * 🐛 fix(intent): explicitly project changed files into alignment summaries Signed-off-by: mendezr <mendezr@users.noreply.github.com> * 🌱 test(dashboard): allowlist human_merge_pin_only leaves in settings parity The settings parity test treats every new hive.yaml leaf as a Settings UI gap unless it is allowlisted; the pin-only policy is yaml-only. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 📖 docs(merge): drop stale 'planned/proposed' wording for landed pin-only schema Reword operator-reference and hive-merge.md so they no longer describe the human_merge_pin_only schema as planned/proposed now that it has landed, and link hive-merge.md to the operator-reference section instead of duplicating the YAML example, field contract and reload instructions. Hive-Fix-Attempt: 2/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 🌱 chore(writeback): annotate status-comment forge plumbing for the direct-write ratchet Merging v5 (#16319, #16321) moved the hive status comment's edit/create/ delete into prstatus.Forge adapters in automerge_stage_labels.go and pr_status_comment.go without updating the write-back ratchet, so TestDirectWriteRatchet failed on every PR's merge commit. Mark the forge adapter calls writeback:gated — they are plumbing under prstatus.Write and the write-back decision lives at the ratcheted entry points — and lower the automerge_stage_labels.go baseline now that the old in-place edit is gone. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 🌱 chore(github): inventory clientStatusForge.CreateComment as a status passthrough TestNotificationWriteSitesInventory fails on this branch because the prstatus.Forge adapter's CreateComment calls CreateIssueComment without a class tag. Register it as a status passthrough wrapper (attribution falls through to the UpsertPRStatusSection caller, all of which are already inventoried) and add the matching row to docs/notifications.md. Hive-Fix-Attempt: 3/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 🐛 fix(intent): accept blank context lines in pin-only patches GitHub's compare API renders empty context lines as "" rather than " ", so classifyPinPatch failed closed on most workflow/Containerfile pin bumps that had a blank line inside the hunk. Treat an empty line after a hunk header as a context line; a blank line before any hunk is still rejected. Also drop the duplicate clientStatusForge.CreateComment row left in docs/notifications.md by the v5 merge. Hive-Fix-Attempt: 5/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 🌱 chore(writeback): drop unjustified writeback:gated annotations and baseline cut Revert the status-comment forge annotations in automerge_stage_labels.go and pr_status_comment.go, and the direct-writes-baseline.txt reduction (automerge_stage_labels.go 5->2), to their v5 state. The annotated EditComment/CreateComment/DeleteComment calls are not actually routed through writeback.Gate.Allowed (prstatus.Write and writeStatusSection never consult it, and only one of four postStageNote callers checks writebackAllowed), so marking them gated would let un-gated writes leave the ratchet permanently. v5 already baselines these files at their current counts, so the change was unnecessary for CI and unrelated to the pin-only policy work in this PR. Hive-Fix-Attempt: 6/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --------- Signed-off-by: mendezr <mendezr@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: mendezr <mendezr@users.noreply.github.com> Co-authored-by: hanthor <5840441+hanthor@users.noreply.github.com> Co-authored-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Why
#16075 says to pilot notification reduction in shadow mode first and to measure repeat or non-actionable writes per active item against matched baseline windows. No such baseline exists today. The only signal is the process-wide created/edited/suppressed tally in an hourly log line. It doesn't say who produced a write, why it was made, or whether it repeated the same condition. This PR adds that measurement. It changes no behaviour.
What
github.notifications.shadowis a new config key, off by default and read live. With it off, the recording path returns before doing any work, so GitHub writes are byte-for-byte the same as today. With it on, writes are still the same. Nothing is suppressed or rerouted.CreateIssueComment, review submissions (relay and auto-merge approve) andRequestReviewers. Each write is attributed to its inventoried producer through a stack walk that skips passthrough wrappers. Each record holds{repo, item, producer, class, provisional condition key (repo, item, class, writer subject), would_notify, reason}. The writer subject is the status-section key forPostNoteOrFold, otherwise the producer. A repeat of the same key within 24h is marked would-suppress, but only forstatusandattention.protocol_command,required_reviewandsecurity_eventwrites are never marked would-suppress. The record keeps only the mentioned or requested logins, never comment bodies. The local log is a ring of 512 records./metricsgainshive_github_comments_total{op}andhive_github_notification_{comments_created,reviews_submitted,review_requests,mentions,suppressed_repeats,would_suppress_repeats,delivery_failures}_total{producer,class}. It also gains thehive_github_notification_active_itemsgauge as the denominator for per-active-item rates.notificationWriteSitescovers 74 producers: every function undersrc/pkgandsrc/cmdthat calls a comment, review, review-request or fold primitive.TestNotificationWriteSitesInventoryparses the tree and fails if a call site has no class tag or if an inventory entry is stale.src/docs/notifications.mdhas the inventory table, including the Hive-maintained workflows that comment. It also explains how to compare matched baseline windows per active item, and states that the 80% reduction is a target, not a claimed result.No new dependencies. Call sites are not refactored; attribution comes from the inventory.
Tests
Closes #16264
Part of #16075
— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@hanthor