Skip to content

✨ [v6] dashboard: General tab controls for contributor_first and contributor_first_grace - #16772

Merged
hivecommons-hive[bot] merged 1 commit into
hivecommons:v6from
Danathar:feat/v6-contributor-first-settings
Nov 5, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
hivecommons:v6from
Danathar:feat/v6-contributor-first-settings

Conversation

@Danathar

@Danathar Danathar commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Summary: A hive owner can now switch an agent's lane to contributor-first, and set its grace period, from that agent's General tab in Settings. Until now both keys could only be set in hive.yaml, so on a hub-hosted spoke only the hub operator could change them. The save refuses exactly what a load would refuse, with the same message, and takes effect on the next governor evaluation without a restart. Governor behaviour is unchanged.

What

Two new controls on the agent General tab, after On Demand:

  • Contributor-first toggle (agents.<name>.contributor_first).
  • Contributor-first grace field (agents.<name>.contributor_first_grace). It shows values like 10m and is blank when unset, with a 10m placeholder.

Both controls carry a help mark that links to "Contributor-first lanes" and a YAML hint.

When the role is not one contributors may act as, the toggle is disabled and one muted line names the fix. That fix is adding the role to hub.contribute_delegatable_roles. Two cases get their own line instead: supervisor (never delegatable) and an agent name with capitals.

The controls are not shown while creating an agent.

Why

Contributor-first lanes merged in #16518, but the two keys stayed on the TODO #11854 allowlist. On a hosted spoke, an owner had no way to use the feature.

How

  • src/pkg/config/contributor_first.go: the per-agent body of validateContributorFirst is now ValidateContributorFirstAgent(name, agent, hub), and validateContributorFirst calls it. So the load and the API share one rule and one message. ContributorFirstDelegatable(name, hub) tells the panel whether the toggle can be turned on at all.
  • GET /api/config/agent/{name}: general carries contributorFirst, contributorFirstGrace and contributorFirstDelegatable. The grace is in seconds and is 0 when unset.
  • PUT /api/config/agent/{name}/general:
    • It accepts contributorFirst (bool) and contributorFirstGrace (seconds).
    • When either key is present, the handler validates its working copy before anything persists. A refusal answers 400 with the load's message and saves nothing.
    • A grace of 0 clears to the default. Omitted keys are left alone, as with onDemand.
    • The existing save path persists the change, including the agent overlay on hosted spokes. The handler's existing Governor.UpdateAgents call applies it live.
  • UI:
    • agentContributorFirstControlsHtml lives in config-agent.js.
    • The grace field's change handler, contributorFirstGraceChanged, lives in shimmy-handlers.js. A blank or unparseable value saves 0.
    • static/index.html is regenerated.
  • Settings parity: the two TODO ✨ dashboard: every hive.yaml setting must be exposed in the Settings dialog (parity) #11854 lines are removed from settings_parity_allowlist.txt. TestSettingsDialogReferencesEveryHiveYAMLLeaf now enforces the controls.
  • Docs: one sentence each in agent-configuration.md (Contributor-first lanes) and contributor-trust-and-roles.md, plus changelog.d/added-contributor-first-settings.md.

Not changed: governor and hub logic, persistence paths, other #11854 keys, and src/crux.

Files

  • src/pkg/config/contributor_first.go, contributor_first_test.go
  • src/pkg/dashboard/api_agent_config.go, agent_config_contributor_first_test.go (new)
  • src/pkg/dashboard/static-src/js/config-agent.js, shimmy-handlers.js, static/index.html (generated)
  • src/pkg/dashboard/settings_parity_allowlist.txt
  • dashboard/test/contributor-first-general.test.js (new)
  • src/docs/agent-configuration.md, src/docs/contributor-trust-and-roles.md, changelog.d/added-contributor-first-settings.md

Tests

  • Go, ./pkg/config/...:
    • The load error and ValidateContributorFirstAgent give identical text for four cases: an undelegatable role, supervisor, a mixed-case name and a negative grace.
    • ContributorFirstDelegatable keeps the defaults when the list adds roles, and excludes supervisor even when it is listed.
  • Go, ./pkg/dashboard/...:
    • GET exposes all three fields, set and unset.
    • PUT stores both keys and writes them to the agent overlay. GET then round-trips them.
    • A grace of 0 clears to the 10m default and keeps the flag.
    • Omitted keys are preserved.
    • An undelegatable role, supervisor and a negative grace each answer 400 with the exact load message. Nothing changes in memory or in the agents dir, even when the request also carries displayName.
    • A covered lane appears in GetState().CoveredLanes on the next Evaluate after the save, with no restart.
  • Node, dashboard/test/contributor-first-general.test.js:
    • It renders the real renderAgentGeneral from index.html for three cases: on, off, and not delegatable. It asserts the toggle state, the disabled state with the fix named, the help marks on both controls and the tooltip wording.
    • It also checks the supervisor line, that agent creation shows no controls, and that the grace handler saves seconds and clears blank or invalid input.
  • Mutation checks: I removed the API validation gate, the toggle's disabled class, the on state, and the grace handler's blank-clearing. Each one made a test fail.
  • Results:
    • go test ./pkg/dashboard/... ./pkg/config/... passes, including TestSettingsDialogReferencesEveryHiveYAMLLeaf and ./pkg/dashboard/webstatic/... against the regenerated index.html.
      • One exception: TestGateFailsClosedWithoutIP6Tables in pkg/config fails identically on an untouched v6 checkout on this machine, because the host lacks ip6tables.
    • cd dashboard && npm test: 51 of 54 pass, including all 6 new tests. The three failures are contribute, contributors-authz and nous-authz, which need express/ws; those weren't installed on this machine.
    • go generate changed only static/index.html.
    • check-api-reference-citations.sh: all references verified.
    • check-changelog-fragment.sh v6: OK.
  • Not run: the Chrome-driven dashboard-tooltip-smoke.mjs. The Go tooltip ratchet tests ran and pass.

Refs #16518, #11854

🤖 Generated with Claude Code

https://claude.ai/code/session_0113KwWU4TkJ8wfy3XjusyGo

…_first_grace

The contributor-first lane keys (hivecommons#16518) were hive.yaml-only, so on a
hub-hosted spoke only the hub operator could switch a lane. The agent's
General tab now has a Contributor-first toggle and a Contributor-first
grace field.

- config: the per-agent body of validateContributorFirst is exported as
  ValidateContributorFirstAgent (validateContributorFirst calls it), plus
  ContributorFirstDelegatable for the panel. The load and the API refuse
  with the same message.
- API: GET general carries contributorFirst, contributorFirstGrace
  (seconds, 0 when unset) and contributorFirstDelegatable. PUT general
  accepts the two keys, validates the copy before anything persists, and
  answers 400 with the load's message on a refusal. 0 clears the grace to
  the 10m default; omitted keys are left alone.
- UI: the toggle is disabled for a role contributors may not act as, with
  one muted line naming the fix; both controls carry help marks and YAML
  hints. Not shown when creating an agent.
- The two TODO hivecommons#11854 parity allowlist lines are removed; docs and a
  changelog fragment say the tab exposes both keys.

No governor change: the save already calls Governor.UpdateAgents, and a
test shows a covered lane is withheld on the next evaluation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0113KwWU4TkJ8wfy3XjusyGo
Signed-off-by: Douglas Baggett <doug.baggett@gmail.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 5, 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 clubanderson 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 5, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit e319fe7 into hivecommons:v6 Nov 5, 2026
74 of 77 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

Evidence bundle `#16772e3a6335` sha256:73efa24b7353acbb60b1a8715086d269656212a8e548184d078c85481e370b3c — download from the dashboard or `hivectl review evidence #16772`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @Danathar holds role owner and GitHub permission maintain on repo; CI green at e3a6335.

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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant