Skip to content

✨ ask: hub panel for optional Ask AI help - #19202

Open
clubanderson wants to merge 7 commits into
v5from
feat/ask-hub-panel
Open

clubanderson wants to merge 7 commits into
v5from
feat/ask-hub-panel

Conversation

@clubanderson

@clubanderson clubanderson commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Phase 2 of the Ask AI help design (src/docs/design/dashboard-ask-ai-help.md): the hub panel. Builds on #19200 (phase 1, the hub backend), because the panel needs its routes. This PR targets v5 so it links to its issue; until #19200 merges its diff also shows phase 1. Merge #19200 first; the panel-only changes are the commit "ask: hub panel for optional Ask AI help".

Fixes #19181

What it does

  • A shared panel component in pkg/askai/web/ (ask-panel.js, ask-panel.css), embedded once and served from 'self', so the hive dashboard (phase 5, ✨ ask: hive panel and live verification for optional Ask AI help (phase 5 of #19177) #19184) reuses the same consent notice, label and fallback. It talks only to the dashboard's own backend (/api/ask/status, /api/ask/consent, /api/ask), never to the vendor.
  • Hub dashboard: an Ask opener in the header and a panel docked to the side (bottom sheet on a phone) that pushes content instead of floating over it (🐛 bug: the floating chat bubble covers dashboard data — dock it or make it transparent #7160). Consent notice with a single confirm before the first question; answers rendered with textContent only, with a Sources list (allowlisted links only, each naming its host) and the "AI generated, may be wrong" label as text; an uncertain flag; Stop sending my questions to withdraw; a docs link in every state (no consent, busy, unavailable, no cited answer).
  • Accessibility: named region, real button with aria-expanded/aria-controls, Escape closes and returns focus to the opener, labelled textarea (Enter sends, Shift+Enter new line), polite live region for answers and errors, aria-busy while asking, visible focus, token colours with fallbacks, no animation.
  • Off is inert: the hub serves the panel tags, /ask-panel.js and /ask-panel.css only when Ask is on. With it off the dashboard document is the embedded bytes unchanged (same ETag), and the security headers are identical on and off. The panel adds one same-origin stylesheet and one same-origin script: no inline script, no third-party host, no CSP change.
  • Operator switch: Scale controls show the effective Ask state (ask_enabled) with a help mark to hub-deployment.md#ask-ai-help; the environment stays authoritative.

Tests

  • Dashboard off vs on: off is byte-identical to the embedded document and serves no assets; on differs only by the panel tags; CSP and other security headers identical; distinct ETags; tags carry no third-party host or inline script.
  • Panel script contract: no innerHTML/outerHTML/insertAdjacentHTML/eval/inline handlers, one fetch to its own base, only https: source links; accessibility markers (region, aria-expanded, Escape, live region, busy, label, Enter) present; the question cap matches the backend's.
  • Scale settings report ask_enabled false and true.

Docs: hub-deployment.md#ask-ai-help (panel behaviour), hub API reference rows for the two assets.

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 19, 2026
@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 19, 2026
@clubanderson
clubanderson changed the base branch from feat/ask-hub-backend to v5 November 19, 2026 01:56
@kubestellar-prow kubestellar-prow Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

UI render evidence

Render evidence captured.

Built from c6812090e4a5.
Screenshots: download the artifact (sign-in to GitHub required).
Run: https://github.com/hivecommons/hive/actions/runs/44444410982

Page Section Viewport Theme File Size
hive overview desktop light hive-overview-desktop-light.png 326 KB
hive overview desktop dark hive-overview-desktop-dark.png 306 KB
hive overview phone light hive-overview-phone-light.png 467 KB
hive overview phone dark hive-overview-phone-dark.png 464 KB
hub-fleet overview desktop light hub-fleet-overview-desktop-light.png 113 KB
hub-fleet overview desktop dark hub-fleet-overview-desktop-dark.png 115 KB
hub-fleet overview phone light hub-fleet-overview-phone-light.png 265 KB
hub-fleet overview phone dark hub-fleet-overview-phone-dark.png 270 KB
hub-dashboard overview desktop light hub-dashboard-overview-desktop-light.png 338 KB
hub-dashboard overview desktop dark hub-dashboard-overview-desktop-dark.png 344 KB
hub-dashboard overview phone light hub-dashboard-overview-phone-light.png 624 KB
hub-dashboard overview phone dark hub-dashboard-overview-phone-dark.png 656 KB

These are fixture renders, not live data: the page was built from the PR head and filled with synthetic data from src/scripts/fixtures/render-evidence/. They show layout and theming, not how real hives behave. How to read them: src/docs/ui-render-evidence.md.

@hivecommons-hive

hivecommons-hive Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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

ℹ️ Sentinel: informational, author is trusted (owner), merge is not blocked. Head 6bd11a5c73ff matched:

  • remote_code_execution: adds a remote-fetch-and-execute, decoded payload, reverse shell or embedded credential (src/pkg/askai/service_test.go)

No sentinel-alert label was added. The finding is recorded in the dashboard Security tab and /api/sentinel; set sentinel.trusted_authors_block: true to block trusted authors too.

@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.

hive/awaiting-ci: rebased onto v5 on top of the rebased #19200 (panel commit only, no conflicts); CI pending - sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: 6a6872810

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

This PR conflicts with v5 itself. Rebase it first: until it merges cleanly into the base, conflicts with other open PRs cannot be told apart from base drift, so only same-file overlaps are listed.

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
#19206 ✨ ask: hive panel and rollout verification for optional Ask AI help same files changelog.d/added-19180-ask-hub-backend.md
changelog.d/added-19181-ask-hub-panel.md
src/docs/api-reference/hub-saas.md
src/docs/api-reference/hub-server.md
src/docs/env-vars.md
src/docs/hub-deployment.md
src/docs/telemetry.md
src/pkg/askai/breaker.go
src/pkg/askai/consent.go
src/pkg/askai/edges_test.go
src/pkg/askai/kapa.go
src/pkg/askai/kapa_test.go
src/pkg/askai/limits.go
src/pkg/askai/sections.go
src/pkg/askai/service.go
src/pkg/askai/service_test.go
src/pkg/askai/sources.go
src/pkg/askai/store_test.go
src/pkg/askai/threads.go
src/pkg/askai/web.go
src/pkg/askai/web/ask-panel.css
src/pkg/askai/web/ask-panel.js
src/pkg/askai/web_test.go
src/pkg/config/ask.go
src/pkg/config/ask_test.go
src/pkg/hub/ask.go
src/pkg/hub/ask_panel_test.go
src/pkg/hub/ask_test.go
src/pkg/hub/assets/dashboard.html
src/pkg/hub/saas.go
src/pkg/hub/saas_pages.go
src/pkg/hub/saas_users_admin.go
src/pkg/hub/scale_settings.go
src/pkg/hub/server.go
src/pkg/prosefilter/outbound_sites_test.go
#19204 ✨ ask: hive backend and hub relay for optional Ask AI help same files changelog.d/added-19180-ask-hub-backend.md
src/docs/api-reference/hub-saas.md
src/docs/api-reference/hub-server.md
src/docs/env-vars.md
src/docs/hub-deployment.md
src/docs/telemetry.md
src/pkg/askai/breaker.go
src/pkg/askai/consent.go
src/pkg/askai/edges_test.go
src/pkg/askai/kapa.go
src/pkg/askai/kapa_test.go
src/pkg/askai/limits.go
src/pkg/askai/sections.go
src/pkg/askai/service.go
src/pkg/askai/service_test.go
src/pkg/askai/sources.go
src/pkg/askai/store_test.go
src/pkg/askai/threads.go
src/pkg/config/ask.go
src/pkg/config/ask_test.go
src/pkg/hub/ask.go
src/pkg/hub/ask_test.go
src/pkg/hub/saas.go
src/pkg/hub/saas_users_admin.go
src/pkg/hub/server.go
src/pkg/prosefilter/outbound_sites_test.go
#19252 ✨ feature: let spokes sync their own registration repos same files src/docs/api-reference/hub-server.md
#19240 ✨ hub: registration key rotation with a grace window same files src/docs/api-reference/hub-server.md
src/docs/env-vars.md
src/docs/hub-deployment.md
#19253 ✨ customers: hub import disclosure, docs and consent views same files src/docs/api-reference/hub-saas.md
src/docs/env-vars.md
src/docs/hub-deployment.md
src/docs/telemetry.md
src/pkg/hub/assets/dashboard.html

@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 hanthor 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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 19, 2026
Adds the ask config block and HIVE_ASK_* env (off by default, inert when
unconfigured, key only from a file under the allowed secret dirs), the
pkg/askai service (Kapa Chat API client pinned to the published
QueryResponse schema, per-person consent store, credential-shape refusal,
source allowlist, plain-text answers, per-person/per-hive/hub-wide limits,
circuit breaker, content-free audit lines) and the hub routes
GET /api/ask/status, PUT/DELETE /api/ask/consent, POST /api/ask and
GET /api/ask/stats. Routes are registered only when the feature is on.

Fixes #19180

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

The Kapa Chat request is a model request (machine, reasonModelPrompt) in
the new outbound-sites inventory from v5. The in-flight test now waits on
a channel instead of polling with time.Sleep, keeping the sleep ratchet.

Signed-off-by: Andy Anderson <andy@clubanderson.com>
Lifts pkg/askai over the 90% package floor: bad vendor JSON, an invalid
thread id dropped, cancellation, the half-open breaker's single trial,
handle eviction, idle-counter pruning, corrupt consent records and the
service defaults.

Signed-off-by: Andy Anderson <andy@clubanderson.com>
Adds the shared panel component (pkg/askai/web: same-origin script and
stylesheet, text-only rendering, consent notice, sources and AI label,
docs-link fallback in every state, keyboard and screen-reader support,
docked layout) and wires it into the hub dashboard only when Ask is on.
With Ask off the dashboard document, its ETag and its headers are
unchanged and the assets are not served. Scale controls show the
effective switch with a help mark.

Fixes #19181

Signed-off-by: Andy Anderson <andy@clubanderson.com>
(cherry picked from commit 2fe253f)
@kubestellar-prow kubestellar-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 19, 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 Nov 19, 2026
@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Mutation testing

⏱️ The 900s mutation budget ran out, so 1 package(s) were not fully mutated and the results below do not cover them:

  • pkg/hub: cut short (partial, no report)

gremlins found 24 surviving mutant(s) in changed files: the code ran under tests, but changing it did not fail any test.

File Line Mutation
src/pkg/askai/consent.go 99 CONDITIONALS_NEGATION
src/pkg/askai/consent.go 99 CONDITIONALS_NEGATION
src/pkg/askai/consent.go 135 CONDITIONALS_NEGATION
src/pkg/askai/kapa.go 170 CONDITIONALS_BOUNDARY
src/pkg/askai/kapa.go 192 CONDITIONALS_BOUNDARY
src/pkg/askai/kapa.go 195 CONDITIONALS_BOUNDARY
src/pkg/askai/limits.go 44 CONDITIONALS_BOUNDARY
src/pkg/askai/limits.go 44 CONDITIONALS_NEGATION
src/pkg/askai/limits.go 122 INCREMENT_DECREMENT
src/pkg/askai/limits.go 137 CONDITIONALS_BOUNDARY
src/pkg/askai/service.go 168 CONDITIONALS_BOUNDARY
src/pkg/askai/service.go 236 CONDITIONALS_NEGATION
src/pkg/askai/service.go 264 INCREMENT_DECREMENT
src/pkg/askai/service.go 266 CONDITIONALS_NEGATION
src/pkg/askai/service.go 269 CONDITIONALS_BOUNDARY
src/pkg/askai/service.go 269 CONDITIONALS_NEGATION
src/pkg/askai/service.go 272 CONDITIONALS_BOUNDARY
src/pkg/askai/service.go 272 CONDITIONALS_NEGATION
src/pkg/askai/service.go 282 CONDITIONALS_NEGATION
src/pkg/askai/service.go 319 CONDITIONALS_BOUNDARY
src/pkg/askai/sources.go 130 CONDITIONALS_NEGATION
src/pkg/askai/sources.go 146 CONDITIONALS_BOUNDARY
src/pkg/askai/threads.go 68 CONDITIONALS_NEGATION
src/pkg/askai/threads.go 68 CONDITIONALS_NEGATION

30 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the mutation/acknowledged label to accept this.

File Line Mutation
src/pkg/askai/breaker.go 13 ARITHMETIC_BASE
src/pkg/askai/consent.go 19 ARITHMETIC_BASE
src/pkg/askai/consent.go 20 ARITHMETIC_BASE
src/pkg/askai/consent.go 21 ARITHMETIC_BASE
src/pkg/askai/kapa.go 38 ARITHMETIC_BASE
src/pkg/askai/kapa.go 43 ARITHMETIC_BASE
src/pkg/askai/kapa.go 45 ARITHMETIC_BASE
src/pkg/askai/limits.go 11 ARITHMETIC_BASE
src/pkg/askai/limits.go 105 CONDITIONALS_BOUNDARY
src/pkg/askai/limits.go 105 CONDITIONALS_NEGATION
src/pkg/askai/limits.go 107 CONDITIONALS_BOUNDARY
src/pkg/askai/limits.go 107 CONDITIONALS_NEGATION
src/pkg/askai/limits.go 109 CONDITIONALS_BOUNDARY
src/pkg/askai/limits.go 109 CONDITIONALS_NEGATION
src/pkg/askai/limits.go 111 CONDITIONALS_BOUNDARY
src/pkg/askai/limits.go 111 CONDITIONALS_NEGATION
src/pkg/askai/limits.go 111 CONDITIONALS_NEGATION
src/pkg/askai/limits.go 113 CONDITIONALS_BOUNDARY
src/pkg/askai/limits.go 113 CONDITIONALS_NEGATION
src/pkg/askai/limits.go 115 CONDITIONALS_BOUNDARY
src/pkg/askai/limits.go 115 CONDITIONALS_NEGATION
src/pkg/askai/limits.go 117 CONDITIONALS_BOUNDARY
src/pkg/askai/limits.go 117 CONDITIONALS_NEGATION
src/pkg/askai/service.go 52 ARITHMETIC_BASE
src/pkg/askai/service.go 52 ARITHMETIC_BASE
src/pkg/askai/sources.go 15 ARITHMETIC_BASE
src/pkg/askai/sources.go 15 ARITHMETIC_BASE
src/pkg/askai/threads.go 13 ARITHMETIC_BASE
src/pkg/config/ask.go 88 ARITHMETIC_BASE
src/pkg/config/ask.go 89 ARITHMETIC_BASE

Verdict: lived (#17349).

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 19, 2026
@github-actions github-actions Bot mentioned this pull request Nov 19, 2026
@kubestellar-prow kubestellar-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 19, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

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.

@hivecommons-hive

hivecommons-hive Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Merge state is dirty (conflicts with v5). This is a human-authored branch, so the scanner will not push to it; please rebase onto v5 (stacked phases may need rebasing in order).


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/awaiting-rebase: mergeable_state is dirty (stacked on #19200). Not pushing to a human-authored branch; rebase onto v5 once #19200 lands.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

@hivecommons-hive

hivecommons-hive Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

scanner: this PR is CONFLICTING with v5 (stacked Ask AI phases). Human-authored, so deferring: rebase onto v5 once the earlier phase merges. Not pushing to this branch.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/scanner: this PR has merge conflicts with v5 (mergeable_state=dirty). It is human-authored, so the hive will not push to it. Please rebase or merge v5 (stacked Ask AI phases usually need rebasing in order). Deferred until the conflict is resolved.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Scanner: this PR is in a conflicting (dirty) state against its base. Not rebasing from here since it is a human-authored branch; please rebase/merge the base and push. Note that #19202, #19204 and #19206 look like a stack, so rebase in order.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

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

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

✨ ask: hub panel for optional Ask AI help (phase 2 of #19177)

1 participant