Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/added-writeback-content-dedupe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The write-back gate is content-aware: an identical comment on the same item within 24h, the same notice fanning out to several items within 60s, or more than 60 comments of one kind per repo per hour is suppressed (`writeback.dedupe`), persisted across restarts, counted on `/api/status` and shown in the Write-back containment drill-down as `duplicate`, `burst` or `rate-capped`.
2 changes: 1 addition & 1 deletion src/docs/api-reference/health-status-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f
| `GET` | `/api/health/deep` | Public | Deep health probe | `pkg/dashboard/server.go:1602` |
| `GET` | `/api/livez` | Public | Kubernetes liveness probe | `pkg/dashboard/server.go:1603` |
| `GET` | `/metrics` | Registered only when `HIVE_METRICS_ENABLED`; requires `Authorization: ****** (403 if the token is unset) | Prometheus metrics | `pkg/dashboard/server.go:1609` |
| `GET` | `/api/status` | Dashboard auth/session | Dashboard aggregate status; `labelPresets[]` (`{key,label,description,labels[],states[]}`) lists the built-in label-filter presets for the Projects cards, led by `needs-human` whose `labels[]` are the effective hard-suppress labels plus `needs-signal`, the hold labels, `stage/071-needs-author` and the reporter-trust awaiting label (#12172); accepts `?fields=a,b` for top-level selection and `?omit=repos` to drop heavy sections, and honors `Accept-Encoding: gzip`; `agents[]` includes busy-pane visibility fields (`kicksUndeliverable`, `busySince`, `lastTranscriptActivity`, `condition`, `conditionMessage`) when a Working pane cannot accept kicks; a working agent also carries `agents[].run` — the live per-run line (#14576): `{since, elapsedS, costUSD, tokens, priced, tests, filesChanged}`, the estimated spend/tokens since the kick was delivered (`lastKickAt`, falling back to `busySince`) (delta of the token collector's per-agent cumulative figure; `priced:false` when the agent has none yet), the last visible test-runner result (`pass`/`fail`/empty) and the last `N files changed` git summary (`-1` when none) parsed from the captured pane; top-level `fleetRun` `{running, hourUSD, hourPriced}` is the governor strip's `running N · $X this hour` figure; `sla` (fleet) and `repos[].sla` (per repo) carry the Delivery SLA block derived from the lifecycle timeline with no extra GitHub calls: `windows.{7d,30d}.{open_to_triage,triage_to_start,start_to_pr,pr_to_merge,open_to_merge}` as `{p50_h,p95_h,n}` (hours, nearest-rank), `history[]` of up to 30 daily buckets `{day,start_to_pr_p50,pr_to_merge_p50,open_to_merge_p50,n_started,n_pr,n_merged}` persisted under `/data/sla-history.json`, `stale_in_progress[]` (`{number,repo,started_at,age_h,agent}` — issues carrying `hive/in-progress` longer than the agent claim TTL with no linked PR), `stale_count`, `merged_7d`, `claim_ttl_s` and, on the fleet block, the effective `targets` (`start_to_pr_h`, `pr_to_merge_h`, `open_to_merge_h`); `staleSince` and `repos[].countsStale` / `countsStaleSince` mark totals served from last-good figures — the previous enumeration (#13382) or the ForgeState cache's last-good counts (#13376); `ci_failure_signals` `{count, last, kicks, unmatched}` is the webhook CI-failure signal store — distinct red (repo, head, check) signals retained, the most recent one `{repo, number, head_sha, check, conclusion, details_url, agent, at}`, webhook-triggered kicks/nudges since boot, and failure deliveries whose head matched no open PR; `hotspots` `{count, actionable, filed}` is the merge-hotspot advisor's one-line summary (files at/above the thresholds, those with a split recommendation, those with a modularize issue filed), absent when the advisor is not wired — details on `GET /api/hotspots` | `pkg/dashboard/server.go:1614` |
| `GET` | `/api/status` | Dashboard auth/session | Dashboard aggregate status; `labelPresets[]` (`{key,label,description,labels[],states[]}`) lists the built-in label-filter presets for the Projects cards, led by `needs-human` whose `labels[]` are the effective hard-suppress labels plus `needs-signal`, the hold labels, `stage/071-needs-author` and the reporter-trust awaiting label (#12172); accepts `?fields=a,b` for top-level selection and `?omit=repos` to drop heavy sections, and honors `Accept-Encoding: gzip`; `agents[]` includes busy-pane visibility fields (`kicksUndeliverable`, `busySince`, `lastTranscriptActivity`, `condition`, `conditionMessage`) when a Working pane cannot accept kicks; a working agent also carries `agents[].run` — the live per-run line (#14576): `{since, elapsedS, costUSD, tokens, priced, tests, filesChanged}`, the estimated spend/tokens since the kick was delivered (`lastKickAt`, falling back to `busySince`) (delta of the token collector's per-agent cumulative figure; `priced:false` when the agent has none yet), the last visible test-runner result (`pass`/`fail`/empty) and the last `N files changed` git summary (`-1` when none) parsed from the captured pane; top-level `fleetRun` `{running, hourUSD, hourPriced}` is the governor strip's `running N · $X this hour` figure; `sla` (fleet) and `repos[].sla` (per repo) carry the Delivery SLA block derived from the lifecycle timeline with no extra GitHub calls: `windows.{7d,30d}.{open_to_triage,triage_to_start,start_to_pr,pr_to_merge,open_to_merge}` as `{p50_h,p95_h,n}` (hours, nearest-rank), `history[]` of up to 30 daily buckets `{day,start_to_pr_p50,pr_to_merge_p50,open_to_merge_p50,n_started,n_pr,n_merged}` persisted under `/data/sla-history.json`, `stale_in_progress[]` (`{number,repo,started_at,age_h,agent}` — issues carrying `hive/in-progress` longer than the agent claim TTL with no linked PR), `stale_count`, `merged_7d`, `claim_ttl_s` and, on the fleet block, the effective `targets` (`start_to_pr_h`, `pr_to_merge_h`, `open_to_merge_h`); `staleSince` and `repos[].countsStale` / `countsStaleSince` mark totals served from last-good figures — the previous enumeration (#13382) or the ForgeState cache's last-good counts (#13376); `ci_failure_signals` `{count, last, kicks, unmatched}` is the webhook CI-failure signal store — distinct red (repo, head, check) signals retained, the most recent one `{repo, number, head_sha, check, conclusion, details_url, agent, at}`, webhook-triggered kicks/nudges since boot, and failure deliveries whose head matched no open PR; `hotspots` `{count, actionable, filed}` is the merge-hotspot advisor's one-line summary (files at/above the thresholds, those with a split recommendation, those with a modularize issue filed), absent when the advisor is not wired — details on `GET /api/hotspots`; `writeback.dedupe` `{enabled, dedupe_same_item, dedupe_burst, rate_capped, hourly_cap, burst_items, burst_window_s, same_item_ttl_s}` is the write-back gate's content layer — the effective `writeback.dedupe.*` settings and the last-hour counts of writes held as `duplicate`, `burst` and `rate-capped` (each also listed under `GET /api/writeback/suppressed`) | `pkg/dashboard/server.go:1614` |
| `GET` | `/api/status/summary` | Dashboard auth/session | Compact agent/governor/budget status summary for pollers; honors `Accept-Encoding: gzip` | `pkg/dashboard/server.go:1615` |
| `GET` | `/api/overview/issues.csv` | Dashboard auth/session | Cached Overview issue-band export as browser-compatible CSV; filters `band`, `repo`/`repos`, `stale`, and `held` are ANDed. | `pkg/dashboard/server.go:1616` |
| `GET` | `/api/overview/issues.json` | Dashboard auth/session | Cached Overview issue-band export as typed JSON with `bands[]` metadata and row fields matching the CSV columns. | `pkg/dashboard/server.go:1617` |
Expand Down
35 changes: 35 additions & 0 deletions src/docs/operator-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,12 @@ writeback:
torch-spyre/torch-spyre: { mode: issues-only } # off | issues-only | labels-only | full
kinds:
sentinel: { min_level: 5, require_label: true, unlabeled_min_level: 6 }
dedupe: # content-aware suppression, see below
enabled: true
same_item_ttl: 24h
burst_items: 2
burst_window: 60s
hourly_cap: 60
```

Everything is editable under **⚙ → Features → Autonomy & ACMM → Write-back
Expand All @@ -1072,6 +1078,35 @@ one line — `writeback: skipped N pre-existing items on <repo> (backfill
off)` — and the dashboard shows "hive can now write to `<repo>`; N existing
PRs were left untouched — enable backfill to process them".

### Duplicate-write suppression

Policy decides whether a kind may write to an item; the content layer under
`writeback.dedupe` decides whether *this* write is worth making. It applies
only to comment kinds whose body the caller handed the gate as the preview
(`sentinel`, `needs_decision_comment`, `supersession_notice`,
`duplicate_fix_notice`, `reporter_trust_hold`, `contributor_adopt`,
`claim_comment`, `gate_comment`, `welcome_comment`); `Allowed()` without a
preview — labels, closes, hold-gate upkeep, task-list edits — stays
policy-only. Three checks run after the policy gate allows a write:

| Check | Key | Suppression reason | Default |
|---|---|---|---|
| Same item | `(repo, item, kind, hash)` of the body with `<!-- hive:… -->` marker arguments, SHAs, RFC 3339 timestamps, durations and whitespace normalised away | `duplicate` — "identical `<kind>` already written to #N at `<time>`" | `same_item_ttl: 24h` |
| Burst across items | `(repo, kind, hash)` of the body additionally stripped of `#N` references, `@mentions` and digits | `burst` — "same `<kind>` already sent to #A within 60s; held to avoid a notification burst"; one WARN per burst | `burst_items: 2`, `burst_window: 60s` |
| Hourly cap | `(repo, kind)` writes in the last hour | `rate-capped` | `hourly_cap: 60` (negative disables) |

Holds are suppressions, not a queue: nothing is replayed later, the next
sweep simply asks again. Merge-path kinds are exempt from the hourly cap
(`hold_gate_notice`, `verdict_label`, `needs_decision_comment`,
`contributor_adopt`, `ci_rerun`, `issue_close`, `supersession_close`,
`issue_file` and every label kind; `writeback.RateCapExemptKinds`). The
hash table is persisted beside the repo records in `writeback.json` so a
restart does not re-fire a notice, pruned by TTL and bounded to 5000
same-item entries. Suppressions appear in the drill-down with the reasons
above, and `/api/status` → `writeback.dedupe` carries the settings plus the
last-hour counters `dedupe_same_item`, `dedupe_burst` and `rate_capped`.
`enabled: false` turns the layer off.

## Suspicious-activity alerts (`sentinel`)

The sentinel evaluates open PRs in the watched repos — human, bot, or agent —
Expand Down
6 changes: 6 additions & 0 deletions src/hive.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,12 @@ knowledge:
# kinds: # per-kind overrides; defaults in docs/acmm-policy-matrix.md
# sentinel: { min_level: 5, require_label: true, unlabeled_min_level: 6 }
# hold_gate_notice: { min_level: 4 } # hive-authored PRs only, always
# dedupe: # content-aware suppression of duplicate / burst comments (comment kinds with a body only)
# enabled: true
# same_item_ttl: 24h # identical body on the same item is held this long
# burst_items: 2 # distinct items that may get one body inside burst_window; the rest are held
# burst_window: 60s
# hourly_cap: 60 # comments per repo per kind per hour; merge-path kinds exempt; -1 disables

# Data directories — all persistent state
data:
Expand Down
1 change: 1 addition & 0 deletions src/pkg/dashboard/static-src/js/config-sentinel.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
<div class="qa-schedule">
<div class="qa-schedule-label">Suppressed write-backs (last 24h): <span id="wb-suppressed-count">…</span></div>
<div id="wb-suppressed-host"><div class="qa-note">Loading…</div></div>
<div class="config-help">Why suppressed: policy reasons (<code>below-min-level</code>, <code>needs-opt-in-label</code>, <code>backfill-off</code>, <code>repo-mode-*</code>, <code>repo-paused</code>) come from the gates above; content reasons ${yamlHint('writeback.dedupe')} ${settingHelpMark('settings', 'features', 'Write-back duplicate suppression', `Comment kinds with a body also pass a content check. <code>duplicate</code>: the same comment (ignoring marker arguments, SHAs, timestamps and durations) already went to this item within <code>same_item_ttl</code> (24h). <code>burst</code>: the same notice just went to another item in this repo within <code>burst_window</code> (60s); held so a sweep does not fan one message out over many PRs. <code>rate-capped</code>: more than <code>hourly_cap</code> (60) comments of that kind on the repo in an hour; merge-path kinds are never capped. Nothing is queued: the next sweep asks again. <code>enabled: false</code> turns it off.`)} are <code>duplicate</code> (same comment on this item again), <code>burst</code> (same notice to several items within a minute) and <code>rate-capped</code> (hourly per-kind ceiling).</div>
</div>
<div class="config-help">Applies on the next sweep. Findings the gate suppressed stay visible in Security → Sentinel and <code>/api/sentinel</code>.</div>
</div>`;
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/dashboard/static-src/js/config-state.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/pkg/dashboard/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45611,7 +45611,7 @@ <h3 style="color:var(--amber);text-align:center">Configure LiteLLM</h3>
{ tab: 'Features', section: 'Integrations & observability', label: 'GitLab and Gitea forges', key: 'gitlab.gitlab_url', text: 'gitlab gitea forgejo codeberg forge instance url token env gitlab.gitlab_url gitlab.token_env gitea.gitea_url gitea.token_env' },
{ tab: 'Features', section: 'Agents & tooling', label: 'Token mint key and TTL', key: 'mint.max_ttl_seconds', text: 'token mint signing key path max ttl lifetime jwt mint.key_path mint.max_ttl_seconds' },
{ tab: 'Features', section: 'Autonomy & ACMM', label: 'Design-first planning', key: 'planning.design_approved_label', text: 'planning design approved label architect revisions concurrent designs plan from label planning.design_approved_label planning.max_concurrent_designs planning.max_design_revisions planning.plan_from_label' },
{ tab: 'Features', section: 'Autonomy & ACMM', label: 'Write-back containment', key: 'writeback.unsolicited.min_level', text: 'write-back writeback containment unsolicited comments labels sentinel hold-gate stage labels opt-in label backfill per repo mode suppressed acmm level writeback.unsolicited.min_level writeback.unsolicited.require_labels writeback.unsolicited.backfill writeback.per_repo writeback.kinds' },
{ tab: 'Features', section: 'Autonomy & ACMM', label: 'Write-back containment', key: 'writeback.unsolicited.min_level', text: 'write-back writeback containment unsolicited comments labels sentinel hold-gate stage labels opt-in label backfill per repo mode suppressed acmm level duplicate dedupe burst rate cap hourly writeback.unsolicited.min_level writeback.unsolicited.require_labels writeback.unsolicited.backfill writeback.per_repo writeback.kinds writeback.dedupe.enabled writeback.dedupe.same_item_ttl writeback.dedupe.burst_items writeback.dedupe.burst_window writeback.dedupe.hourly_cap' },
{ tab: 'Features', section: 'Work intake & issue lifecycle', label: 'Superseded PR grace period', key: 'supersession_sweep.grace_period', text: 'supersession superseded grace period close contributor pr supersession_sweep.grace_period' },
{ tab: 'Features', section: 'Quality loops & release health', label: 'Compliance posture windows', key: 'compliance.posture_checks.window_days', text: 'compliance posture look-back window history retention compliance.posture_checks.window_days compliance.posture_checks.history_days' },
{ tab: 'Features', section: 'Agents & tooling', label: 'Swarm banner wording', key: 'swarm.event_name', text: 'swarm event name call to arms leaderboard title banner swarm.event_name swarm.call_to_arms swarm.leaderboard_title' },
Expand Down Expand Up @@ -56055,6 +56055,7 @@ <h3 class="features-section-title">${esc(s.title)}</h3>
<div class="qa-schedule">
<div class="qa-schedule-label">Suppressed write-backs (last 24h): <span id="wb-suppressed-count">…</span></div>
<div id="wb-suppressed-host"><div class="qa-note">Loading…</div></div>
<div class="config-help">Why suppressed: policy reasons (<code>below-min-level</code>, <code>needs-opt-in-label</code>, <code>backfill-off</code>, <code>repo-mode-*</code>, <code>repo-paused</code>) come from the gates above; content reasons ${yamlHint('writeback.dedupe')} ${settingHelpMark('settings', 'features', 'Write-back duplicate suppression', `Comment kinds with a body also pass a content check. <code>duplicate</code>: the same comment (ignoring marker arguments, SHAs, timestamps and durations) already went to this item within <code>same_item_ttl</code> (24h). <code>burst</code>: the same notice just went to another item in this repo within <code>burst_window</code> (60s); held so a sweep does not fan one message out over many PRs. <code>rate-capped</code>: more than <code>hourly_cap</code> (60) comments of that kind on the repo in an hour; merge-path kinds are never capped. Nothing is queued: the next sweep asks again. <code>enabled: false</code> turns it off.`)} are <code>duplicate</code> (same comment on this item again), <code>burst</code> (same notice to several items within a minute) and <code>rate-capped</code> (hourly per-kind ceiling).</div>
</div>
<div class="config-help">Applies on the next sweep. Findings the gate suppressed stay visible in Security → Sentinel and <code>/api/sentinel</code>.</div>
</div>`;
Expand Down
Loading
Loading