Repository navigation
✨ Workflow models: ingest Tekton from a cluster and written specs (LLM-assisted, inferred) - #17713
Conversation
|
[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 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. @clubanderson this PR is held at Why:
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. |
Mutation testing⏱️ The 900s mutation budget ran out, so 2 package(s) were not fully mutated and the results below do not cover them:
❌ gremlins did not produce a report for 1 package(s), so no verdict can be derived from this run (see the job log):
3 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the
Verdict: |
7cab8fc to
ba69f28
Compare
Add pkg/workflowmodel/ingest/cluster: lists tekton.dev Pipelines, Tasks, PipelineRuns (newest N per pipeline) and Tekton Triggers objects from a kube context via kubectl, serialises them as cluster/<ns>/<kind>/<name>.yaml and feeds the existing file-based Tekton ingester so there is one parser. Last run status per pipeline is recorded as an observed annotation and coverage finding, never as an inferred lifecycle element. Clear errors for missing CRDs, RBAC denials, unknown contexts and missing namespaces; caps on namespaces, runs, objects and bytes. Refs #17620 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Add pkg/workflowmodel/ingest/spec. Markdown/plain text is split into heading sections with line ranges; a deterministic stage turns step lists, conditional sentences and role nouns into a compiling skeleton (states, columns, chained transitions, manual guards, gates, roles). An optional LLM stage asks a Completer to refine the skeleton with the Model schema (reflected from the Go types), the fact vocabulary and the compiler's refusal rules; the answer is parsed with DisallowUnknownFields, normalised by Mark (inferred confidence on every state/event/gate, ingested origin, spec:<heading>#L<a>-L<b> citations validated against real sections, pipelines/sources/agents stripped, provenance ingested-unreviewed) and compiled, with one retry quoting the diagnostics before falling back to the skeleton. This is the only LLM seam in the workflow-model stack. Refs #17620 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Add POST /api/workflows/ingest/cluster, POST /api/workflows/ingest/spec and GET /api/workflows/ingest/capabilities in a new handler file, registered by one line from registerWorkflowRoutes. The cluster route runs the kubectl-backed fetcher and the existing Tekton ingester; the spec route runs the deterministic extractor and, when a model gateway is configured and useLLM is on, the gateway-backed refinement through the reviewer TurnRunner with a larger completion budget. Owner role, audit workflow_ingest, same response shape as repo ingest plus source, llm and sections. 422 when kube access or a gateway is missing. Wire WorkflowRepoFile, WorkflowClusterRunner and WorkflowSpecLLM deps from cmd/hive; document the three routes and their schemas additively in dashboard/openapi.json. Refs #17620 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Two collapsible panels appended to the Ingest view by a single guarded hook in renderWorkflowIngest: From a cluster (context select from kubectl's contexts or a text field, namespace, selector, all-namespaces, observed-run list) and From a written spec (paste, URL or repository file; a Use AI assistance checkbox shown only when the capabilities route reports a gateway, LLM note and section list in the result). Both reuse the repository ingest's result block, diagnostics and diagram. Pure renderers over module state, token-only CSS in its own sheet, node test for gating, modes, request validation and result rendering. Refs #17620 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Append the RFC phase 6 section to the design doc — data flow for both sources, the kubectl seam, the observed-run rule, the LLM boundary and what enforces it (strict unmarshal, Mark, Compile, one retry, fallback), prompt outline, failure modes and caps — and add the changelog fragment. Refs #17620 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
govet's inline check flags the reflect.Ptr alias. Refs #17620 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
ba69f28 to
6a6c71c
Compare
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
RFC phase 6 of the workflow-models RFC (#17620), on v5: two more ways into a draft lifecycle model — Tekton from a live cluster context and a written process spec, the latter optionally LLM-assisted with every output element
confidence: inferred.What
A. Tekton from a cluster —
pkg/workflowmodel/ingest/clusterkubectl), so the package uses aRunnerseam (Kubectl{Kubeconfig}in production, a table-driven fake in tests) instead of a fake dynamic client.Fetchliststekton.devPipelines/Tasks/PipelineRuns (newest N per pipeline, default 3, max 20) andtriggers.tekton.devEventListeners/Triggers/TriggerTemplates/TriggerBindings, serialises tocluster/<ns>/<kind>/<name>.yamland feeds the existing file-based Tekton ingester — one parser, citations at those virtual paths.runs[]in the response +workflow.hivecommons.dev/observed-run/<pipeline>annotation +CodeObservedRuncoverage finding. Observed, never an inferred lifecycle element.ErrNoCRD422,ErrForbidden403,ErrNoContext404,ErrNamespaceRequired400,ErrNoRunner422,ErrTooLarge413. Caps: 25 namespaces, 20 runs/pipeline, 500 objects, 8 MiB, 60 s/kubectl call.B. Written spec —
pkg/workflowmodel/ingest/specSplit→ heading sections with line ranges; refsspec:<heading>#L<a>-L<b>.prompt.go,schema.go). Accepted only afterjson.UnmarshalwithDisallowUnknownFields→Mark→Compile. One retry with diagnostics appended (MaxAttempts = 2), then fallback to the skeleton (spec-llm-fell-back).Markforces: apiVersion/kind/name,meta.version "1",meta.source spec:<origin>,meta.provenance ingested-unreviewed, every state/event/gateorigin: ingested+confidence: inferred, citations validated against section refs (unknown → whole-doc ref +spec-llm-citation-replaced),pipelines/sources/agentsstripped. Annotationworkflow.hivecommons.dev/llm-assisted: "LLM-assisted (model <id>)"when the gateway's answer was used.C. Dashboard
pkg/dashboard/api_workflows_ingest_sources.go, registered by one line inregisterWorkflowRoutes:GET /api/workflows/ingest/capabilities→{cluster, clusterReason, contexts[], spec: {llm, model}}POST /api/workflows/ingest/cluster {context?, namespace | allNamespaces, selector?, runsPerPipeline?, repository?, save?, name?}→{model, compiled, diagnostics, profile, files, pipelines, source: "cluster:<ctx>/<ns>", runs[], namespaces[], entry?}POST /api/workflows/ingest/spec {text | repo+path | url, useLLM?, repository?, save?, name?}→{model, compiled, diagnostics, profile, source: "spec:<origin>", llm: {used, model, attempts, accepted, error?}, sections[], entry?}workflow_ingest, 201 +entryon save.useLLMdefaults to "gateway configured"; requesting it without one → 422. No kube access → 422. URL fetch goes through the existing SSRF guard (https, public host).TurnRunner(newWorkflowSpecRunner, 8 000-token budget) — no provider is called directly. New depsWorkflowRepoFile,WorkflowClusterRunner,WorkflowSpecLLMwired fromcmd/hive.WorkflowIngestCapabilities,WorkflowClusterIngestResult,WorkflowSpecIngestResult.static-src/js/config-workflows-ingest-sources.js+css/workflows-ingest.css; one guarded hook at the end ofrenderWorkflowIngest. Two<details>panels: From a cluster (context select from capabilities or text input, namespace, selector, all-namespaces, observed runs) and From a written spec (paste / URL / repo file; Use AI assistance only when a gateway is reported; LLM note + section list). Reuses the repo-ingest result block, diagnostics and diagram. Tokens only, notoLocaleString, no forced downloads.D. Docs
docs/design/workflow-models.md— "Ingest from cluster and from written specs (RFC phase 6)".changelog.d/added-workflowmodel-ingest-cluster-spec.md.The LLM boundary
The gateway is reached only through
spec.Completer, only fromspec.Ingest, only to draft. Nothing in derivation, compile, the engine, or the other ingesters imports a gateway. Its output cannot beconfirmed, cannot cite anything but the spec, cannot add pipelines, cannot bypassCompile; the worst it can do is be ignored. Tests cover accepted / retry-then-accepted / bad JSON / non-compiling / citation replacement / fallback.Tests & coverage
ingest/cluster95.9%,ingest/spec98.6% (fake Runner / mock Completer; no network).TestWorkflowSpecRunnerUsesLargerBudget.go vet,go test ./pkg/workflowmodel/... ./pkg/dashboard/ ./pkg/dashboard/webstatic/ ./cmd/hive/green apart from the known macOS-onlyTestConfigExportReportsPersistedPath/TestKnowledgeDrainLegacyMemory; ratchets unchanged;index.html -checkclean; changelog guard OK.Gaps
Runnerseam rather than client-go's fake dynamic client (no client-go in go.mod; adding it was out of scope).Refs #17620