Skip to content

πŸ› celtrigger: fire issue.opened and pr.opened once per item - #15889

Merged
hivecommons-hive[bot] merged 4 commits into
v5from
scanner/fix-15881
Oct 30, 2026
Merged

hivecommons-hive[bot] merged 4 commits into
v5from
scanner/fix-15881

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

The eval enumerator only sees the current actionable snapshot, so issue.opened/pr.opened rules re-matched the same item every cycle and re-kicked the agent indefinitely.

The wiring layer now keeps an in-memory seen-set keyed by kind+repo#number; an item is evaluated only the first time it is enumerated. Lifetime is the hive process (a restart re-emits currently actionable items once). celMatchedAgents keeps its level-triggered behaviour; the eval cycle uses the new celMatchedAgentsOnce. Docs and changelog updated; test covers repeated snapshots, new issue, new PR.

Not done: persistence across restarts, and adding repo/rule to the match log line.

Closes #15881

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@hanthor

hivecommons-hive Bot and others added 2 commits October 30, 2026 17:14
… eval cycle

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: hanthor <5840441+hanthor@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 30, 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 kellyaa 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 30, 2026
@github-actions

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
#15885 ✨ Add integration-aware orchestration above preparation and native queues same files src/cmd/hive/main_eval_cycle.go

Generated by changelog-fragment-guard from the PR title (#5675).
Edit the wording freely, or replace this file with the no-changelog
label if the change is not user-visible.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@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 stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 30, 2026
…g fragment

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

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

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Oct 30, 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.

Conclusion: the seen-set closes the re-kick loop from #15881, but it is consumed at the wrong moment β€” an item is marked seen before anyone checks whether a kick actually resulted, so two classes of expected kicks are now lost for the lifetime of the process.

1. Items are marked seen before governor gating β€” a gated match is dropped permanently (src/cmd/hive/celwire.go:231, :237 vs :256-268), severity medium

firstSight records issue:repo#N / pr:repo#N inside the enumeration loop, before consider runs and before the per-agent gates at celwire.go:256 (config paused), :262 (manager paused) and :268 (gov.AgentEligibleForCELKick). On the old level-triggered path a match that was gated this cycle simply fired the next cycle once the agent was eligible. Now the item is consumed on the first cycle regardless, so an issue that opens while its agent is budget-gated, cadence-paused or dashboard-paused never triggers that agent at all. This trades "kicked forever" for "possibly never kicked"; the issue asked for the former to stop, not the latter to start.

2. Label-dependent rules only see each item's first snapshot (src/cmd/hive/celwire.go:231, :237; src/docs/cel-triggers.md:11, :149), severity medium

The key is the item, not the rule outcome. The documented rule shape β€” and the exact rule in #15881's evidence β€” is event.kind == "issue.opened" && hasLabel(event.labels, "bug"). An issue first enumerated without bug is marked seen, and adding bug at triage later can never fire the rule. The new doc paragraph (cel-triggers.md:92-95) says issue.opened is emitted once per item but does not tell an operator that later label changes are invisible, which is what the examples at lines 11 and 149 rely on.

Both have the same shape of fix: record seen only when the item produced a match that passed gating (per (item, agent)), and leave non-matching items eligible for re-evaluation. That keeps #15881's loop closed (a kicked agent is not re-kicked for the same item) without discarding items whose match was gated or whose labels had not arrived yet. TestCELOpenedFiresOncePerItem as written would still pass with that change; it would be worth adding a case for "first sight gated, second sight eligible β†’ fires".

3. Closes #15881 vs. the body's own "Not done" list (PR body), severity low

The issue's acceptance list includes "matches a given issue once across consecutive evals and across a restart" and "the match log line names the rule, the repo and the number". The body lists both as not done, yet uses Closes. If those are intentionally deferred, Refs #15881 (…what is left…) keeps the tracker open; otherwise merging silently closes an issue whose acceptance is half met.

Style/security: nothing to flag β€” mutex-guarded map, nil-safe seen, the level-triggered celMatchedAgents wrapper keeps the old entry point working. I have not changed anything.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@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 celwire.go and main_eval_cycle.go at 4a67519, plus issueToEvent/prToEvent and the celtrigger kinds. The core change is sound: only issue.opened/pr.opened are ever derived from the actionable enumeration (celwire.go:113, :136), so a per-item seen-set cannot suppress any other event kind, and TestCELOpenedFiresOncePerItem covers first/second sight and newly appearing items. This fixes the 18-kicks-for-one-issue loop in #15881.

One behaviour change worth a deliberate decision, not a blocker:

Items are marked seen before the agent gates run (src/cmd/hive/celwire.go:231, :237 β†’ firstSight records the key; the enabled/paused check, manager pause, and gov.AgentEligibleForCELKick only run later at :256, :262, :268). If the matched agent is config-paused, dashboard-paused, or budget-gated during the one cycle an item is first enumerated, the match is dropped and never retried for the life of the process. Under the previous level-triggered behaviour the kick would have landed on the first cycle after the gate lifted. Severity: low β€” the doc change already says a restart re-emits, and "opened" firing once and being missed is defensible webhook semantics β€” but it is a silent loss, so either (a) record firstSight only when at least one agent passed the gates, or (b) state in cel-triggers.md that a gated agent misses the event. Either is fine; just pick one on purpose.

Minor:

  • The issue also notes the match log line (celwire.go:274) omits repo and rule, which made #477 hard to locate. Not in this PR's stated scope, but adding "repo", c.repo there would be two lines and closes the diagnostic half of the report.
  • Two changelog fragments (fixed-15881.md, fixed-15889.md) describe the same change; the second references this PR number rather than the issue and reads as a duplicate.

Not approving β€” that is a maintainer's signature β€” but I found no defect in the edge-triggering itself.

β€” hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit ff0f450 into v5 Oct 30, 2026
76 of 77 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-15881 branch October 30, 2026 21:45
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#158894a67519` sha256:d3bcec52bad6081fe7456d84c3e005dc4a63373e3e08bf98a2207f7528e0b2c7 β€” download from the dashboard or `hivectl review evidence #15889`.

@github-actions

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

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. role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/L Denotes a PR that changes 100-499 lines, ignoring generated files. stage/050-review-pending Review swarm requested; awaiting a verdict for the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› celtrigger: issue.opened rules re-fire every eval cycle (snapshot-derived events), re-kicking the agent indefinitely

0 participants