Repository navigation
✨ [v6] workflows: owner toggle for model-based stage derivation from the dashboard - #17887
Conversation
…ashboard
workflow.enabled gates rules-based stage derivation and bound-model label
provisioning, but could only be set by editing hive.yaml, which hosted
hives cannot do. Add PUT /api/workflows/enabled {enabled} (owner-gated,
persists hive.yaml, audited workflow_enabled / workflow_disabled) and a
"Derive stages from bound models" switch in Settings → Workflows → Library
that confirms before turning on. The stage engine and the tracker already
read cfg.Workflow.Enabled live and the reloader mutates the same *Config
in place, so no reload hook is needed. Turning on also provisions every
bound repository's model labels at once through the sweep's memoised
ensureStageLabels path (new automerge.Engine.EnsureStageLabels, wired as
Dependencies.WorkflowProvisionLabels); failures come back as warnings and
the next sweep retries. The Repos binding row says "columns only — turn
on derivation in Workflows" when a binding exists while the flag is off.
Refs #17620
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
[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 |
|
Changelog: this PR changes code but carries no changelog entry If it is user-visible — a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
Refs #17620 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. @clubanderson this PR is held at Failing checks:
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 Read the handler against the v6 tree and the callers it relies on; this looks correct to me. What I verified
One observation, not a defect: |
There was a problem hiding this comment.
All three red checks (changelog-fragment-guard, relative links and anchors resolve, and native-queue-policy, which only re-reports the first) have a single cause in the cherry-pick conflict resolution of src/docs/api-reference/configuration.md.
The v6 table already contains the 13 rows for /api/config/convergence … /api/config/governor/inference-auth at lines 107-121, with v6-correct citations (api.go:276, :300, :315, :316, …). The resolution kept the v5 copies of the same rows as well, so they appear a second time at lines 122-134 with v5 line numbers (api.go:259, :261, :265 … :298). On v6 those lines don't register those routes — e.g. api.go:259 is PUT /api/config/governor/attribution — which is exactly the 13 DRIFT entries the citation guard prints.
Fix: delete lines 122-134 of configuration.md (keep the new PUT /api/workflows/enabled row at 135, which cites api_workflows.go:28 correctly). bash src/scripts/check-api-reference-citations.sh --fix will not do this for you — it rewrites line numbers, it does not de-duplicate rows.
The Go changes are the same as #17886 (I verified them against the v5 tree there, and the v6 cherry-pick of api_workflows.go, workflow_labels.go, and automerge_stage_labels_gc.go is identical to the v5 diff). No other findings.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
CI triage (hive scanner, comment-only on a contributor-authored branch): all three red checks share one root cause. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
Refs #17620 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Mutation testingHead ⏱️ The 900s mutation budget ran out, so 1 package(s) were not fully mutated and the results below do not cover them:
1 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the
Verdict: |
There was a problem hiding this comment.
One cherry-pick artifact to fix before this lands; the Go wiring checks out.
src/docs/api-reference/configuration.md:122-134 — the conflict resolution described in the body ("keeping v6 content plus the v5 additions") re-added 13 rows that already exist at :107-121: /api/config/convergence (GET/PUT), /api/config/governor/advisory, /replan, /work-source, /security, /project-observability, /inference-auth now each appear twice, byte-for-byte identical. Only the final PUT /api/workflows/enabled row (:135) is new. Dropping :122-134 leaves the intended +1 row; src/docs/api-reference.md:16 row count for this page should be re-checked after that.
What I verified in the tree at 20ff603:
src/cmd/hive/workflow_labels.go:36-40builds a freshautomerge.Engineper call, but the memo it relies on is genuinely shared:stageEngineOptionsis async.Oncesingleton (src/cmd/hive/stage_engine.go:37-55) andEnsureStageLabels(automerge_stage_labels_gc.go:192-197) goes throughstageTrackerOrShared()→sharedStageTracker(automerge_stage_labels.go:461-466). So the "sweep's own memoised path" claim in the body holds.api_workflows.gohandler setsConfig.Workflow.Enabledbefore provisioning, andstageEngineWorkflowFor(stage_engine.go:65-67) reads that flag per call, so the model'sLabelDefsare included in the provisioning pass rather than only the built-in family.- Save failure reverts the flag before returning 500; provisioning failure is a warning, not a failure of the flip — matches the body.
Not a blocker, noting only: the 60s workflowProvisionTimeout is a single budget across all bindings (api_workflows.go provisionBoundWorkflowLabels), so with many bound repos the later ones can time out and land in warnings[]. The sweep retries, so that is acceptable; just expect it on large fleets.
— hive: agent=reviewer 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 |
Top-up of #17886 onto v6 (cherry-pick of 124a25e; conflicts in openapi.json, api-reference/configuration.md, hive.yaml.example resolved keeping v6 content plus the v5 additions).
Summary
workflow.enabledgates rules-based stage derivation (stageEngineWorkflowFor,stage_tracker_workflows.go) and bound-model label provisioning, but it could only be set by editinghive.yaml. Hosted hives have no YAML access, while binding (PUT /api/workflows/bindings) already works from the dashboard. This closes the gap.Refs #17620
What changed
API —
PUT /api/workflows/enabled{"enabled": bool}(pkg/dashboard/api_workflows.go)requireOwnerRole;400on a non-boolean / missing body;503without config.Config.Workflow.Enabled,saveConfig()(reverts the flag if the save fails →500).workflow_enabled/workflow_disabled(a no-op flip is not audited).{enabled, changed, bindings[], warnings?[]}.cmd/hive/stage_engine.gostageEngineWorkflowForand the tracker readcfg.Workflow.Enabledon every call, and the hive.yaml reloader does*b.cfg = *newCfgin place, so the next derivation pass sees the new value.automerge.Engine.EnsureStageLabels(ctx, owner, repo)exposes the sweep's memoisedensureStageLabelspath (built-in family + bound modelLabelDefs, GC reconcile, shared tracker memo).cmd/hive/workflow_labels.gowires it asDependencies.WorkflowProvisionLabelsover the process-shared stage-engine options; the handler runs it for every binding when turning on, surfacing failures aswarnings[](the next sweep retries).UI
workflow.enabled) with a one-line explanation (off: columns only; on: stages derived by the bound model's rules and model labels provisioned). Confirms before turning on; reflectsGET /api/workflowsenabled; locked for non-owners and while a PUT is in flight.static/index.htmlregenerated viago generate; tokens only (--sp-*,--status-warn).Docs —
dashboard/openapi.json(additive),docs/api-reference/configuration.mdrow (+ citations script passes), design doc note,hive.yaml.exampleworkflow:block, changelog fragment.Tests
TestWorkflowEnabledPut— owner gate, 400 on bad bodies, persist to hive.yaml, audit, provisioning fan-out + warnings, idempotency, save-failure revert, 503 without config.TestWorkflowProvisionLabels*(cmd/hive),TestEnsureStageLabelsExportedUsesEngineTrackerAndPolicy(automerge).TestWorkflowsEnabledToggleWiring/TestWorkflowsEnabledToggleNode(JS harness).check-inline-js.js,check-api-reference-citations.sh, OpenAPI parity tests, gofmt/vet clean.Flip it by hand