Skip to content

🐛 fix: supported agent channels and issue-opened evaluation wake - #15904

Merged
clubanderson merged 2 commits into
v5from
fix/webhook-channel-save
Oct 31, 2026
Merged

clubanderson merged 2 commits into
v5from
fix/webhook-channel-save

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Root cause

The agent Channels form still offered webhook/discord/schedule/bead after their trigger runtimes were removed (#5591). The owner-only PUT /api/config/agent/{name}/channels correctly rejects them with HTTP 400, but the client discarded its actionable JSON error and retained the rejected local edit.

Separately, a signed issues opened delivery scheduled a targeted item refresh but did not wake the governor: only relabeled issues entered the existing dirty-issue wake path. This left first-seen CEL issue rules waiting for reconciliation.

Changes

  • Offer only the supported kick channel; explain top-level CEL triggers and the existing signed GitHub App/hub receiver. Saving a channel does not install a GitHub webhook.
  • Display server JSON errors or HTTP status, preserve last accepted channels on rejection, serialize channel writes, and guard against late responses after switching dialogs.
  • Include opened issues in the existing dirty-issue/wake path; reuse the cached evaluation and 🐛 celtrigger: fire issue.opened and pr.opened once per item #15889 first-seen semantics, without a new dispatcher or weakened auth.
  • Document scanner-new-issue configuration and first-seen/restart caveats.

Validation

CI-only per AGENTS.md. Added UI execution guards for successful/rejected saves, authenticated request shape, state preservation and async races; backend validation/persistence invocation preservation; and verified versus invalid-signature issue-opened wake coverage. Regenerated embedded SPA with make dashboard-gen. Changed Go files pass gofmt -l. Existing #15889 covers once-per-item CEL routing. No deployment, live configuration changes or webhook registration.

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 31, 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 nicholasjackson 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 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
#15853 ✨ Complete native GitHub queue CI and policy integration same files src/pkg/dashboard/static/index.html
#15910 ✨ Show ordered preparation rail without changing pipeline stages same files src/pkg/dashboard/static/index.html
#15895 ✨ feature: add abandoned counts to contributor leaderboards same files src/pkg/dashboard/static/index.html
#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/index.html
#15849 ✨ Show online ClankeR IDs on the Contributors count pill same files src/pkg/dashboard/static/index.html
#15731 📖 docs: split the operator reference CONFLICT src/docs/operator-reference.md
#15888 ✨ ioscan: accept omp as a tool-less classifier CLI backend same files src/pkg/dashboard/static/index.html

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Hive filed review findings that do not block this PR as backlog items:

Cap: 10 backlog item(s) per PR per day.

@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 diff at 445a3f3 against v5 and the callers. Looks correct to me.

  • Backend. webhookIssueDirtyTarget (webhook_cache.go:603-612) adding opened feeds the same res.DirtyIssues that webhookWakeReason (api_github_webhook.go:208-210) already turns into a WebhookWake, so no new dispatcher is introduced and the invalid-signature path is unchanged (TestGitHubIssueOpenedDeliveryWakesExistingEvaluation covers both). One side effect worth knowing: markIssueDirty also increments TakeDirtyIssueCount (webhook_cache.go:253-271), so an opened issue now also lets the un-park sweep run ahead of its interval. Harmless — the sweep is a no-op for an issue that was never parked — but it is a small extra scheduling effect the body doesn't mention.
  • Client. handleAgentConfigChannels returns jsonError → {"ok":false,"error":msg} (api.go:663-666; api_agent_config.go:1243-1246), which is exactly what the new saveChannels reads. The _configState === state guard is sound because config-dialog.js:7 and :60 assign a fresh object on open/close. state.data.channels is now only written after a 2xx, so a 400 from ValidateChannels no longer leaves the rejected edit in the local model.
  • Unmentioned fix. The old render emitted data-arg0="+i+" as a literal string (quotes were inside the JS string), so toggle/remove on existing channels passed "+i+" as the index. This PR corrects it to data-arg0="'+i+'" (config-agent.js:636-637). Worth a line in the body since it's a real behaviour fix beyond the stated scope.

CHANNEL_COLORS still lists the removed types, which is right: persisted webhook/discord/schedule/bead entries still render with their colour and can be removed.

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

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 tree at bab8a74 before the body. Looks correct to me.

Backend. webhookIssueDirtyTarget (src/pkg/github/webhook_cache.go:603-613) is the only caller change; the PR-shaped and unknown-repo guards it inherits are unchanged. Adding opened has exactly two downstream effects, both read: res.DirtyIssues feeds webhookWakeReason (src/pkg/dashboard/api_github_webhook.go:208) so the eval wake fires, and markIssueDirty lets runIssueUnparkSweepIfDue run early (src/cmd/hive/main_sweeps.go:1416); the sweep's own gates are inside SweepIssueUnparkCommands, so an early tick on a freshly opened issue is harmless. The new TestGitHubIssueOpenedDeliveryWakesExistingEvaluation pins the signature gate (401, no wake) before the verified path.

UI. The identity guard _configState === state is sound because the dialog reassigns _configState on open and close (config-dialog.js:7, :60) rather than mutating it, so a late response from a closed dialog cannot toast or re-render. saveChannels now reads data.error, which matches jsonError(w, err.Error(), 400) from config.ValidateChannels at api_agent_config.go:1243-1244. One thing the body does not mention: the old row markup had data-arg0="+i+" inside a single string literal (config-agent.js:635-636 on v5), so toggle/remove always received the literal text +i+ as the index; the new quoting ('"+i+"') fixes that.

Docs. event.kind == "issue.opened" and event.repo exist (celtrigger.go:34, :65), GITHUB_WEBHOOK_SECRET is the receiver's env var (api_github_webhook.go:26), and the #webhook-driven-pr-cache-invalidation anchor resolves (operator-reference.md:1735).

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

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

docs-currency (read head bab8a74)

The new docs check out against the code: reopened does wake evaluation (src/pkg/dashboard/api_github_webhook.go:211-212), GITHUB_WEBHOOK_SECRET is the receiver's env var (api_github_webhook.go:26), issue.opened is a real event.kind (src/docs/cel-triggers.md:80), and both new cross-doc anchors resolve.

One operator-facing example still contradicts the new text:

  • src/hive.yaml.example:271-276 still shows type: webhook (with events: ["issues.opened", ...]) and type: bead as example agent channels. src/pkg/config/config.go:6861-6862 rejects both at load ("has no trigger runtime … permanently unkicked"), and the new cel-triggers.md section says these runtimes were removed. An operator copying the example hits exactly the failure this PR documents.
    # channels:                             # Trigger channels (omit = governor kicks only)
    #   - type: kick                        # Only `kick` has a runtime; webhook/discord/schedule/bead were removed (#5591)
    # For GitHub-event routing use a top-level `triggers:` CEL rule, e.g.
    #   expr: event.kind == "issue.opened" && event.repo == "org/repo"
    # (see docs/cel-triggers.md#run-the-scanner-for-newly-seen-github-issues)

@clubanderson
clubanderson merged commit 78eaf7a into v5 Oct 31, 2026
78 of 79 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/webhook-channel-save branch October 31, 2026 00:56
@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

hivecommons-hive Bot added a commit that referenced this pull request Oct 31, 2026
Resolve the operator-reference.md conflict by keeping the redirect stub and
porting the #15904 webhook wording (issues opened/labeled/unlabeled wake
evaluation, CEL trigger pointer, Agent Channels kick-only) into
operator-reference/runtime-and-quota.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicts-with-open-pr Open PR has a merge conflict with another open PR dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant