Repository navigation
π celtrigger: fire issue.opened and pr.opened once per item - #15889
Conversation
|
[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
|
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>
β¦g fragment Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) omitsrepoandrule, which made #477 hard to locate. Not in this PR's stated scope, but adding"repo", c.repothere 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
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
The eval enumerator only sees the current actionable snapshot, so
issue.opened/pr.openedrules 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).
celMatchedAgentskeeps its level-triggered behaviour; the eval cycle uses the newcelMatchedAgentsOnce. 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