Skip to content

✨ feat(attention): /hive ack and /hive snooze with the attention action contract - #16372

Merged
hivecommons-hive[bot] merged 1 commit into
v5from
scanner/fix-16359
Nov 3, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v5from
scanner/fix-16359

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closes #16359

Part of #16270 (parent tracker; siblings #16358, #16361-#16363 own the opt-in flag, reminders and the attention queue)

Why

Attention episodes page one named person about one condition, but until now the recipient could only "answer" by fixing it. Reminders (#16361-#16363) need a recorded ack/snooze to read, and every event needs to say the same things so a recipient can act without digging — and must never be mistaken for a release mechanism.

What

  • src/pkg/attention/ack.go — ParseCommand (/hive ack [episode], /hive snooze <duration> [episode], durations 90m/4h/2d/1w, 1m–30d), MayAct (episode recipient or maintainer), Store.Apply which records AckedAt/AckedBy and SnoozedUntil/SnoozedBy on the episode. Non-recipient non-maintainers get ErrNotPermitted and nothing is recorded. AckedBy/SnoozedBy are additive JSON fields at the end of Episode; the existing locking pattern is reused (no delivery call under the lock), so no overlap with 🐛 fix(attention): drop the store lock across delivery calls and prune resolved items #16365.
  • src/pkg/attention/contract.go — Event (who, what changed/why now, requested action, evidence, what Hive tried, what happens next, how to resolve), Validate, Render (also emits the ack/snooze instructions and the fixed NotApproval wording: "Acknowledgement is not approval … release no security, merge or review hold"), and NewObservation which refuses incomplete events.
  • src/pkg/github/attention_command.go + 9-line hook in SweepIssueUnparkCommands — the existing /hive command sweep answers ack/snooze on items with an open episode (local ledger check first, so other items cost no API call), only on the admitting hive, once per comment via the existing reply marker, reusing commenterMayUnpark for the maintainer check. It writes only comments (reply + attention status section).
  • Docs: command-table rows and an "Attention ack and snooze" section in src/docs/maintainer-commands.md; an "Attention action contract" section in src/docs/notifications.md. Changelog fragment at root changelog.d/.

Tests (acceptance)

  1. TestAckAndSnoozeRecordedOnEpisodeByRecipientOrMaintainer, TestAckAndSnoozeRejectedForOtherCallers, TestParseCommand (attention); sweep test ignores a read-only non-recipient.
  2. TestSweepAttentionAckSnoozeRecordOnlyAndNeverReleaseHolds — a PR carrying hold, stage/085-needs-decision, needs-human: no label add/remove, no issue PATCH, and every non-GET request is a comment write (no merge/review endpoint). TestAckAndSnoozeChangeOnlyReminderState pins that only reminder fields change.
  3. TestEventRenderEmitsEveryContractField — every field plus "Acknowledgement is not approval"; incomplete events refused.
  4. Docs updated.

Deliberately not here

No reminder scheduling reading the new state, no opt-in flag / issue-side status card, no attention queue, no producer routed through NewObservation yet (siblings own those). Existing Store.Update is untouched.

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

…on contract

Attention episodes (#16270) page one named person about one condition, but
the recipient had no way to say "seen it" or "not now" short of fixing the
condition, so the reminder siblings would have nothing to read. This adds
the two answers through the existing /hive command sweep and pins down what
every attention event must tell its recipient.

- attention.ParseCommand / Store.Apply: `/hive ack [episode]` and
  `/hive snooze <duration> [episode]` (1m-30d) record AckedAt/AckedBy and
  SnoozedUntil/SnoozedBy on the episode (additive JSON fields). Only the
  episode's recipient or a write/maintain/admin maintainer may act; anyone
  else gets ErrNotPermitted and nothing is recorded.
- The un-park sweep answers them on items with an open episode (local
  ledger check first, so other items cost no API call), only on the
  admitting hive, once per comment via the existing reply marker. It writes
  only comments: no label, hold, merge gate or review verdict is touched.
- attention.Event / NewObservation: the action contract (who, why now,
  requested action, evidence, what Hive tried, what happens next, how to
  ack/snooze/resolve) with the fixed "Acknowledgement is not approval"
  wording; incomplete events are refused.

Store locking is unchanged (Apply makes no delivery call), so this does not
collide with #16365. Reminder scheduling, the opt-in flag/status card and
the attention queue stay with siblings #16358 and #16361-#16363.

Closes #16359

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 3, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nicholasjackson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 3, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

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: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Evidence bundle `#16372c871480` sha256:eb4638c75d4244a722b560af53cb110ffbc3c52d9198df1b1b1916fa270cce9a — download from the dashboard or `hivectl review evidence #16372`.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#16371 ✨ feat(notifications): attention-pilot opt-in flag and issue-side hive:status card same files src/docs/notifications.md
#16367 ✨ feat(notifications): neutralise incidental mentions in copied text inside hive-authored bodies same files src/docs/notifications.md
#16351 🐛 fix(automerge): route engine status-comment creates through the notification primitive same files src/docs/notifications.md
#16365 🐛 fix(attention): drop the store lock across delivery calls and prune resolved items same files src/pkg/attention/episodes.go

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the new attention and github code against the v5 tree, not just the diff. Looks correct to me.

What I verified:

  • No collision with the un-park sweep. /hive ack / /hive snooze fall through parseUnparkCommand (src/pkg/github/issue_unpark_command.go:988-999 only matches approve/help/decision) and isUnparkProseAssent rejects any line starting with / (:1051), so a parked item never also gets the prose-hint or label-driven reply for the same comment. The hook runs before the park paths (:311-318) and reuses postUnparkReply's ID marker, so answeredUnparkCommentIDs dedupes across both.
  • Reminder state is actually honoured. Store.Apply sets AckedAt/SnoozedUntil and clears WouldNotify; the existing Report recompute at src/pkg/attention/episodes.go:358 already gates on e.AckedAt.IsZero() && !now.Before(e.SnoozedUntil), and the flap/reopen branch at :337-340 preserves the ack. So no change to Report was needed, as the body says.
  • Record-only. Apply touches only episode fields and save(); the sweep side writes a reply comment and an UpsertPRStatusSection("attention", …) — no label, state or merge endpoint. TestSweepAttentionAckSnoozeRecordOnlyAndNeverReleaseHolds pins this with hold + stage/085-needs-decision + needs-human present.
  • Per-item cost. Snapshot is a local map read and Gate.AttentionStore() is sync.Once-cached (src/pkg/writeback/gate.go:205), so items without an open episode add no API call, as claimed.

One non-blocking observation: items with an open episode now list comments twice per sweep (once in replyAttentionCommands, again in the un-park path when parked). Fine at current scale; noting it in case the attention queue (#16363) widens the set.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 660e5d1 into v5 Nov 3, 2026
86 of 92 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-16359 branch November 3, 2026 03:13
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[scanner] Attention pilot: /hive ack and /hive snooze commands and the attention action contract

0 participants