Skip to content

✨ Expose Event triggers in Settings with scoped scanner presets - #15913

Merged
clubanderson merged 7 commits into
v5from
feat/settings-event-triggers
Oct 31, 2026
Merged

clubanderson merged 7 commits into
v5from
feat/settings-event-triggers

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Summary

  • Add owner-only Settings → Features → Work intake & issue lifecycle → Event triggers, linked directly from Agent Configuration Channels; scanner first-seen issue routing requires no YAML editing.
  • Provide scoped issue/PR presets, advanced CEL editing and explicit removal without inventing an enabled field. Preserve existing rules/order/priorities and unrelated configuration.
  • Validate CEL to bool before durable saves, require trigger-list If-Match revisions, and publish runtime changes only after successful persistence. Existing cache recompiles on next evaluation without restart or seen-history reset.
  • State first-seen ACTIONABLE/per-process semantics, restart replay and normal execution gates prominently; saving does not install/register GitHub sources or webhooks.

Validation

  • Added API/auth/persistence/conflict, UI roundtrip/error/preset/advanced preservation, concurrent config save, and runtime reload/first-seen regressions.
  • Regenerated dashboard SPA; changed Go files formatted. Per AGENTS.md, tests/builds/guards run only in CI.

No deployment, live configuration changes or webhook registration.

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 31, 2026
@github-actions

github-actions Bot commented Oct 31, 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
#15871 🐛 fix: stage tracker gives immediate Let-hive-decide feedback and says why a human is wanted same files src/pkg/dashboard/static/index.html
#15890 🐛 dashboard: point operator-reference help marks at the section sub-pages same files src/pkg/dashboard/static-src/js/config-features.js
src/pkg/dashboard/static-src/js/config-tabs.js
src/pkg/dashboard/static/index.html
#15849 ✨ Show online ClankeR IDs on the Contributors count pill same files src/docs/api-reference/dashboard-misc.md
src/pkg/dashboard/static-src/css/config-dialog.css
src/pkg/dashboard/static/index.html

@hivecommons-hive

hivecommons-hive Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Why:

  • the branch conflicts with the base and needs a rebase

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

Review findings from reviewer (folded here because this head already carries its hive review):

Read the Go side against the tree at 6c45a1c — api_event_triggers.go, config/event_triggers.go, the celwire.go/celtrigger/wire.go changes and the eval path that consumes them. Looks correct to me.

What I verified:

  • Preset expressions match at runtime. handleEventTriggersPut writes event.repo == "<repo as configured>" (api_event_triggers.go:111). The eval loop builds events from actionable.Issues.Items via issueToEvent with Repo: iss.Repo (celwire.go:118), and Issue.Repo is the string from c.repos, which is cfg.Project.Repos verbatim (client.go:1460; main_github_app.go:290), with splitRepo qualifying short names only for the API call (client.go:1791-1795). So a short-name repo entry and the preset's event.repo agree; the "retain the configured spelling" comment at :35 is accurate.
  • No lock reentrancy from the new saveMu read. CompileFromConfig now calls TriggerRulesSnapshot, which takes saveMu (event_triggers.go:14). Its two callers — celEngineFor (celwire.go:91, holding only globalCELEngine.mu) and the PUT handler (:137, before SaveTriggerRules) — never hold saveMu, and the only save observer is configWatcher.SkipNext (main.go:3817), so nothing under saveMu reaches a recompile.
  • Revision check is not TOCTOU-only. The handler pre-checks If-Match against a snapshot (:113-116) and SaveTriggerRules re-checks under saveMu before saveLocked (event_triggers.go:30-33), publishing c.Triggers only after the write succeeds — a concurrent unrelated Save() can't clobber the rules, and a concurrent trigger save returns 412.
  • TriggerRule is four scalars (config.go:440-445), so using it as the remaining map key for "unchanged legacy rule passes verbatim" is sound; new/edited rules are the only ones required to name an existing agent, matching the comment at :124-126.

The api-reference line renumbering is the usual citation shift from touching server.go-adjacent files; cel-triggers.md and dashboard/openapi.json describe the two new endpoints as implemented (owner-only, If-Match required, 428/412 semantics).

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@clubanderson

Copy link
Copy Markdown
Member Author

/lgtm
/approve

@kubestellar-prow

Copy link
Copy Markdown
Contributor

@clubanderson: you cannot LGTM your own PR.

Details

In response to this:

/lgtm
/approve

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: clubanderson

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

The pull request process is described 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 31, 2026
@github-actions github-actions Bot added conflicts-with-open-pr Open PR has a merge conflict with another open PR and removed conflicts-with-open-pr Open PR has a merge conflict with another open PR labels Oct 31, 2026
Signed-off-by: Andy Anderson <andy@clubanderson.com>
Signed-off-by: Andy Anderson <andy@clubanderson.com>
@clubanderson

Copy link
Copy Markdown
Member Author

CI repair: the Settings search audit correctly required a real anchored settings row. The Event triggers shell now uses the standard config-field row class and preserves its triggers key, rather than exempting the entry from the guard. The original source/API/UI tests passed; the associated coverage failure was downstream of that search audit. Waiting for the new exact head to rerun all applicable checks.

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 31, 2026
Signed-off-by: Andy Anderson <andy@clubanderson.com>

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Read the server side (api_event_triggers.go, config/event_triggers.go, celtrigger/wire.go, cmd/hive/celwire.go) against v5 and the existing savers in config.go. The persistence and publish path looks correct to me.

  • Owner gate and revision fence. Both handlers call requireOwnerRole first (api_event_triggers.go:49, :59). The PUT rejects a missing If-Match with 428, compares it against the live snapshot before validation (:116-119), and SaveTriggerRules re-compares under saveMu (event_triggers.go:30-33), so a save racing another editor between the two checks still fails with 412 rather than clobbering.
  • Runtime sees only persisted rules. SaveTriggerRules writes a shallow copy (next := *c, same idiom as config.go:7537) and assigns c.Triggers only after saveLocked returns nil (event_triggers.go:36-40); TriggerRulesSnapshot takes the same saveMu, and celEngineFor now keys its signature off that snapshot (celwire.go:72), so the engine recompiles on the next evaluation from the committed rules, with no restart and no half-saved state visible.
  • Invalid CEL cannot be persisted. CompileFromConfig runs on the proposed rules before any write (api_event_triggers.go:139), and celEngineFor's existing fail-closed branch still covers a rule edited on disk.
  • Legacy rules pass verbatim. TriggerRule is a comparable value struct (config.go:440-445), so old == rule preserves existing rules without re-validating their agent, while new/edited rules must name a configured agent (:124-136). Preset repos are checked against cfg.Project.Repos only, matching the body's "no wildcard / no all-repos" claim.
  • dec.DisallowUnknownFields() plus the trailing-EOF check mean an enabled field or a second JSON object is a 400, as the body states.

One small observation, not a defect: CompileFromConfig and celEngineFor now take the process-wide saveMu on every call via TriggerRulesSnapshot (wire.go:19, celwire.go:72). That lock also wraps the YAML write in every Save*, so an evaluation that lands mid-save will wait on the file write. The copy is tiny and the signature check makes the call cheap, so I would not block on it, but it is a new coupling between the evaluation path and config persistence.

CI: all completed checks green at 1433bbf; merge state is blocked by conflicts-with-open-pr, which I did not resolve here.

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

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 31, 2026
Signed-off-by: Andy Anderson <andy@clubanderson.com>
@clubanderson

Copy link
Copy Markdown
Member Author

Integrated the newly landed default branch once to resolve citation-only merge conflicts with the native queue Settings feature. Preserved native/preparation modules and manifest entries, regenerated the combined SPA and CI-reported citations, and moved the Event triggers editor styling into CSS without increasing any style-ratchet budget. Fresh exact-head CI is required for this composed result; no live changes.

Signed-off-by: Andy Anderson <andy@clubanderson.com>

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Read the handler, the config save path and the eval wiring at c065fdc; this looks correct to me.

  • Preset repo spelling is right. The preset writes event.repo == <configured spelling> (src/pkg/dashboard/api_event_triggers.go:103). I traced the runtime side: issueToEvent/prToEvent (src/cmd/hive/celwire.go:118,138) copy iss.Repo/pr.Repo, which the enumerator sets from the configured repo string (src/pkg/github/client.go:1858,1974), bare or owner-qualified exactly as in project.repos. So the generated rule matches what the engine actually sees, even though NormalizedEvent.Repo's doc says "fully-qualified" (celtrigger.go:64) — that doc comment is the stale one, not this code.
  • Lock discipline holds. TriggerRulesSnapshot/SaveTriggerRules (src/pkg/config/event_triggers.go:14-40) take the same saveMu as Config.Save (config.go:7192) and the agent-scope saver (agent_repos.go:228), and celEngineFor + CompileFromConfig now read through the snapshot, so evaluators never see a half-saved slice. Revision check is repeated inside the lock, so the handler-side precondition at api_event_triggers.go:106 is only a fast path.
  • Owner-gated on both verbs, DisallowUnknownFields + trailing-token check, CEL compiled to bool before persisting, publish-after-persist. No native browser dialogs in the new UI module.

Open question (pre-existing, not introduced here): items re-read via webhook patches (src/pkg/github/webhook_item_patch.go:52,137) take repo from the webhook path; if that is ever owner-qualified while project.repos is bare, a preset rule would miss those events. I did not trace that far — worth a glance by whoever owns the webhook path.

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

@clubanderson
clubanderson merged commit 9c9b08d into v5 Oct 31, 2026
79 of 80 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the feat/settings-event-triggers branch October 31, 2026 02:19
@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

@clubanderson

Copy link
Copy Markdown
Member Author

Verified source merge: 2026-10-31T02:19:31Z, squash 9c9b08d. Tested exact head c065fdc; all 11 required contexts and full applicable CI passed, including both architecture image builds, freshness/security checks, tests, coverage, and lint. ARM64 job 124408436152 completed successfully at 02:18:35Z. Guarded admin squash used --match-head-commit and preserved DCO.

Settings → Features → Work intake & issue lifecycle → Event triggers; also linked from Agent → Configuration → Channels. Select the scanner first-seen issue preset, an existing agent, and a managed repository, then Save Event triggers. Changes apply on the next evaluation without restarting or clearing seen history. First-seen ACTIONABLE semantics are once per process, including existing items and replay after restart; existing execution gates remain. Saving does not install signed GitHub delivery. Source-only: no live configuration, webhook registration, or deployment changes performed.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant