Skip to content

[scanner] Persist producer-independent condition episodes with single per-repo attention admitter and uncertain-POST reconciliation #16267

Closed

Description

@hivecommons-hive

Problem

The #16075 decision: after the single status writer lands, "persist producer-independent condition episodes and uncertain-POST reconciliation; a non-atomic list-before-create check alone is not cross-instance deduplication." Today dedupe is content-hash based (src/pkg/writeback/dedupe.go: same body on same item within 24h, cross-item burst, hourly cap). That collapses identical text but not the same condition described differently by different producers — e.g. three reports of one ARM64 download failure on #16046, or the same informational sentinel finding re-posted per head SHA on #16026.

Scope

  • Condition key (producer-independent): (repo, item, action class, responsible recipient, normalized subject), where subject is:
    • CI: failing required job name + normalized error class (not run ID / SHA);
    • sentinel/security: the existing src/pkg/findingidentity key (subject/predicate/location — no SHA);
    • holds/decisions: the required decision identifier.
      SHA, run IDs and links are stored as evidence, not key material.
  • Episode state machine per key: observed → actionable → notified → acknowledged → resolved, with first_seen, last_seen, paged_at, paged_to, acked_at, snoozed_until, resolved_at, last attempt + evidence link. Same failure on a new push only advances last_seen. A recurrence within a flap window after resolved_at reopens the same episode (status edit, no ping); after the window it is a new episode. A materially new risk, action, or owner creates a new event.
  • Persistence across restarts and rolling upgrades, bounded, beside the existing writeback dedupe table (same pattern). State loss must not replay history: on empty/corrupt state, reseed from existing status cards/markers without sending, and surface uncertain active episodes in the status card for reconciliation.
  • Authoritative cross-instance admission: exactly one hive admits notifying attention writes per repo; other hives record would-notify and fold into hive:status only.
  • Uncertain-POST reconciliation: each attention comment carries a hidden marker <!-- hive:attention key=<hash> attempt=<id> -->; after a timeout/5xx with unknown outcome, look up that attempt id before any retry; retries never mint a new episode.

Decision taken by hive: admission owner = an explicit per-repo config setting (e.g. github.attention.admitter: <hive_id>); default unset ⇒ no hive sends attention events through the new path and current quiet-mode behaviour is unchanged (additive, backward-compatible, no new dependency). Flap window default 12h (inside the 6–24h range discussed), configurable. The marker lookup is used only for reconciling this admitter's own uncertain POSTs, not as cross-instance dedupe.

Acceptance criteria

  • Scenarios from the RFC as tests: same failure across pushes ⇒ one episode, one attention write; duplicate scanner/runtime/Actions reports of one condition ⇒ one episode; restart mid-episode ⇒ no re-page; empty state ⇒ no historical replay; uncertain POST that actually landed ⇒ found, not duplicated; green/red/green within flap window ⇒ no second page; genuine recurrence after window ⇒ new episode; new urgent security finding ⇒ immediate event, never suppressed by an existing episode.
  • Non-admitter hives never create an attention comment (test).
  • Unset admitter ⇒ identical behaviour to today.
  • Episode state is bounded and survives restart (test with persisted file).
  • Security/merge holds, mandatory review and machine-consumed commands are untouched.
  • No new dependency or paid service.

Likely files

New package (e.g. src/pkg/attention), src/pkg/writeback/dedupe.go / gate.go (hook point), src/pkg/findingidentity, src/pkg/github/pr_status_comment.go, src/pkg/config/config.go, docs.

Evidence

RFC #16075 §2 ("durable condition identity") and acceptance scenarios; maintainer decision on #16075; thread analysis points 2–4.

Part of #16075

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

Activity

  1. added
    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
    agent/scannerCreated or modified by the scanner agent
    on Nov 2, 2026
  2. github-actions commented on Nov 3, 2026

    @github-actions
    Contributor

    @hivecommons-hive[bot] this issue was closed by @clubanderson as completed.

    If this was closed by a merged PR, the fix only takes effect once it ships in a tagged release and your deployment updates to it — check your running version against the fix before concluding the fix failed.

    If you are still seeing the problem, comment /reopen and it will be reopened for you — you do not need write access. Please add what you are still observing (running version, logs, steps) so it is not closed the same way again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/scannerCreated or modified by the scanner agenthelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions