Synced from Hive. This page is pulled from hivecommons/hive@v5 during the docs build. Edit the canonical source in the Hive repository.

Task workflows: executable DAGs of agent steps

Status: Implemented. Tracking issue #20642. Phases (a) to (g) shipped in #20662, #20667, #20672, #20700, #20701, #20726, #20707, #20708 and #20710. This page is the plan they were built against and is not rewritten as they ship; where it and the code differ, the code and the operator pages win: DAG workflows (reference) and the task workflows guide (walkthrough). Not yet shipped: step reports from sandboxed kicks through the request spool (see Reporting completion); today reports reach hive only through the in-pod drop box.

Code references were checked against v5 at cc95e876. Line numbers drift; the named symbols are the stable handles.

Problem

The workflow model (src/pkg/workflowmodel, workflow-models.md) is a lifecycle state machine for GitHub issues and pull requests. It ingests GitHub Actions workflows, Tekton files, a live Tekton cluster or a markdown spec, and renders and observes the pipelines it finds. needs and runAfter are display edges: nothing in hive executes a declared DAG. Dispatch (src/pkg/scheduler/workflow_dispatch*.go) kicks an agent for an issue or PR in a state, and judges completion by what appears on GitHub.

A regression-pipeline use case needs something different:

  • about ten agent “skills” (deploy, test-case generation, test runs, a report) that run many times, not once per issue;
  • run on IBM Bob agents (backend: bob);
  • declared in YAML or JSON;
  • some steps in parallel, later steps depending on earlier ones;
  • a failed step retried, and the next steps started only once it succeeds (deploy must succeed before any test runs);
  • started by a scheduler or by an external system.

Hive can kick one agent with a prompt (POST /api/kick/{agent}), can run an agent on a cadence, and can watch a request-file drop box. It cannot say “run these ten prompts in this order, retry this one, wait for those three, and tell me when it is done”. Today an operator would have to build an external dispatcher that polls GET /api/kick-outcomes and guesses success from the pane, with no structured result and no retry semantics.

Goals and non-goals

Goals:

  • A new executable workflow kind, TaskWorkflow, in the existing API group.
  • Hive owns the DAG state machine. No external dispatcher is needed.
  • Step completion is reported by the agent through a hive-provided command, over the request-file pattern hive already uses, with no network callback inside hive and no new credential in the prompt.
  • Retries, timeouts, a concurrency cap, agent pools and dependency gating.
  • Manual, cron and API triggers; an optional scoped token for an external scheduler.
  • Optional, off-by-default outbound notification of run and step completion.
  • A dashboard for runs.
  • Off by default behind workflow.tasks.enabled; a hive that does not turn it on behaves exactly as before.

Non-goals:

  • Executing ingested Tekton or GitHub Actions pipelines. Those stay rendered and observed. Phase (f) only converts their shape into a TaskWorkflow draft that an owner completes with agents and prompts.
  • Changing what an agent may do on GitHub. Task workflows add no permission; see Safety.
  • A general job scheduler for non-agent work. Every step is an agent kick.

Spec

A TaskWorkflow is a document in the same group as the workflow model:

apiVersion: workflow.hivecommons.dev/v1alpha1
kind: TaskWorkflow
metadata:
  name: regression            # lower-case letters, digits, hyphens; <= 63
  description: Nightly regression on the Bob pool
spec:
  params:                     # inputs to every run
    - name: build
      required: true
    - name: env
      default: staging
      description: Target environment
  pools:                      # named agent pools, referenced by steps
    bob: [bob-1, bob-2, bob-3]
  concurrency: 3              # max steps running at once in one run
  timeout: 6h                 # whole-run timeout (optional)
  schedule:                   # optional cron trigger
    cron: "0 2 * * *"
    tz: Europe/Rome
    params: { build: nightly }
  notify:                     # optional, see Outbound notification
    url: https://ci.example.com/hooks/hive
    events: [run, step]
  steps:
    - id: deploy
      pool: bob
      prompt: |
        Deploy build {{params.build}} to {{params.env}}. Report the
        deployed URL as the result.
      retry: { max_attempts: 3, backoff: 2m }
      timeout: 30m
    - id: gen-tests
      pool: bob
      depends_on: [deploy]
      prompt: Generate test cases for the deployment at {{steps.deploy.result}}.

Steps

FieldMeaningDefault
idUnique step id: lower-case letters, digits and hyphens, at most 63.required
agentOne hive agent by name.one of agent/pool
poolA pool name from spec.pools; any free member may run the step.one of agent/pool
promptThe step’s instructions, a template (below).required
depends_onStep ids that must all have succeeded before this step starts.none
retry.max_attemptsTotal attempts, including the first.1
retry.backoffWait before the second attempt (Go duration).1m
retry.factorMultiplier applied to the wait after each attempt.2
retry.max_backoffCeiling on the wait.30m
timeoutPer-attempt timeout, from delivery of the kick.workflow.tasks.default_step_timeout (60m)
on_failurestop or continue (below).stop
approvalrequired holds the step for an owner before it is kicked.none

Parallelism comes from the DAG: every step whose dependencies have all succeeded is ready, and ready steps start in declaration order up to spec.concurrency (and never more than the hive-wide workflow.tasks.max_concurrent_steps).

on_failure applies once a step has used all its attempts:

  • stop (default): no new step starts in this run. Attempts already running are left to finish and their outcomes are recorded, then the run ends failed. Steps that never started are skipped.
  • continue: the step’s transitive dependants are skipped, and branches that do not depend on it keep going. The run ends failed, because a step failed, but everything that could run did.

Prompt templates

A prompt may reference:

ReferenceValue
{{params.<name>}}The run’s value for a declared param.
{{steps.<id>.result}}The result text of a step this step depends on, directly or transitively.
{{run.id}}, {{step.id}}, {{step.attempt}}, {{workflow.name}}Identity of the current attempt.

Templates are plain substitution, not a language: no conditionals, loops or functions. An unknown reference is a validation error, as is a steps.<id> reference to a step that is not an ancestor (its result could not exist yet). Values are inserted verbatim.

Run framing

Hive prepends a fixed header to the rendered prompt so the agent knows how to report:

[hive task workflow] workflow regression, run r-20261130-0200-7f3a, step deploy, attempt 1 of 3.
When the step is finished, report it with exactly one of:
  hive-step-done --run r-20261130-0200-7f3a --step deploy --attempt 1 --status succeeded --result "<short result>"
  hive-step-done --run r-20261130-0200-7f3a --step deploy --attempt 1 --status failed --result "<why>"
Use --result-file <path> instead of --result for a longer result.

The header plus the rendered prompt must fit the kick limit (10,000 characters, maxKickPromptLen in api_agent_control.go); a rendered prompt that does not fit fails the attempt with a clear reason instead of being truncated.

Limits

Enforced by validation, as named constants:

LimitValue
Steps per workflow50
Params per workflow32
depends_on per step50
Prompt template8,000 characters
retry.max_attempts10
Step timeout1m to 24h
Run timeoutat most 7 days
Pool members16
Result kept per step16 KiB (longer results are truncated and marked)

Validation

Validate returns diagnostics in the same shape as the workflow model’s Compile (workflowmodel.Diagnostic: code, subject, message, severity), so the editor can show them the same way. Errors block saving as enabled; a draft with errors can be saved disabled, as the model store does for models that do not compile.

Errors:

  • task-duplicate-step: two steps share an id.
  • task-unknown-dep: depends_on names no step.
  • task-cycle: the dependency graph has a cycle (the message names one).
  • task-no-agent: a step has neither agent nor pool, or both.
  • task-unknown-agent: a named agent, or a pool member, is not a configured agent on this hive.
  • task-unknown-pool: pool names no entry in spec.pools.
  • task-bad-template: a prompt references an undeclared param, a step that is not an ancestor, or an unknown name.
  • task-missing-param: a schedule omits a required param that has no default.
  • task-bad-schedule: the cron expression or tz does not parse (same parser as governor cadences, pkg/config/cadence.go).
  • task-limit: any limit above is exceeded.
  • task-bad-duration, task-bad-name, task-bad-notify for malformed fields.

Warnings:

  • task-agent-has-cadence: a step agent also has an active governor cadence, so ordinary work may compete with workflow steps for it. Dedicated agents (cadence paused) are recommended for task workflows.
  • task-sandbox-agent: informational, the agent runs sandboxed kicks; the step reports through the sandbox spool (below).

Runner

The runner is a single loop in the hive process (pkg/taskworkflow, started from cmd/hive only when workflow.tasks.enabled is on). It owns every run’s state machine and is the only writer of run state.

States

Run: pending → running → succeeded | failed | cancelled, with paused (budget exhausted, below) as a resumable side state.

Step:

pending ──deps succeeded──▶ ready ──(approval required)──▶ awaiting-approval
                              │                                 │ owner approves
                              ▼                                 ▼
                        queued (agent busy / cap) ──kick delivered──▶ running
                                                                        │
                    ┌──────────────── reported succeeded ◀──────────────┤
                    ▼                                                   │ reported failed,
               succeeded                                                │ timeout, turn ended
                                                                        │ without a report
                                           attempts left? ──yes──▶ retry-wait ──backoff──▶ queued
                                                │ no
                                                ▼
                                              failed

skipped is set on steps that can no longer run (an upstream failure, a stop, a cancel); cancelled on attempts the owner cancelled.

One tick

Every tick (default 2s, the drop box poll interval of the other relays) the runner, for each active run:

  1. Reads step-done reports from the drop boxes and applies the ones that match a running attempt (below).
  2. Times out attempts past their timeout, and attempts whose agent turn has ended without a report for longer than workflow.tasks.report_grace (default 30s, so a report written just before the turn ended is still read).
  3. Moves retry-wait steps whose backoff has elapsed to queued.
  4. Marks steps ready whose dependencies all succeeded; applies on_failure for steps that just failed.
  5. If the governor’s budget is exhausted for an agent the run needs, pauses the run (below). Otherwise kicks queued steps, oldest first, while the run’s running count is under its concurrency cap and the hive-wide running count is under workflow.tasks.max_concurrent_steps.
  6. Ends the run when no step can make progress, and writes its final state.

Kicking a step and choosing an agent

A step is kicked through the same runtime call the kick API uses (AgentMgr.SendKickAsync, which keeps every synchronous precondition: unknown agent, paused, stopped, sandbox rejection). The runner records the kick with Governor.RecordKick so it counts against spend, writes a task_workflow_step_kicked audit entry, and stores the delivery time as the attempt’s kicked_at.

An agent takes one kick at a time. The runner only kicks an agent that is idle: running, not paused, no kick delivery in flight, its last turn settled (KickOutcome.Settled(LastKick)), and not already holding another task workflow attempt (the runner keeps that claim itself). Otherwise the step stays queued for it. Steps queued for the same agent start in the order they became ready, across runs.

A pool step takes the first free member. A retry prefers a free member other than the one that ran the failed attempt, and falls back to the same member when it is the only free one. A pool of N agents can run N steps at once; a single agent serialises every step that names it.

Reporting completion: hive-step-done

hive-step-done --run <run_id> --step <step_id> --attempt <n> \
  --status succeeded|failed [--result <text> | --result-file <path>]

The command writes a request file and waits (bounded) for the hive’s answer, exactly like hive-status (hive-status.md) and hive-open-pr. It has two transports:

  • In-pod agents write to the drop box /var/run/hive-metrics/step-requests. The relay attributes the request to the agent whose per-agent UID owns the file (the same forge-resistance check as authorizeAgentStatus in cmd/hive/agent_status_relay.go), never to a name in the file. Without per-agent UIDs the relay refuses, fail closed.
  • Sandboxed kicks (container mode, the default for T3 backends such as Bob on the contributor path) cannot reach the pod-local drop box. They write a step request into the kick’s existing request spool, HMAC signed with the per-kick spool key (HIVE_SANDBOX_SPOOL_KEY, see crux/sandbox_review_spool.go), and the relay attributes it to the manifest’s agent. hive-step-done joins sandbox.RelayNames so every sandbox gets it.

Neither transport puts a token in the prompt or opens a network path into hive: the run and step ids in the prompt are not secrets, because a report is accepted only when all of these hold:

  • the run exists and is active;
  • the step’s current attempt is running with that attempt number;
  • the reporting agent (from the UID or the spool manifest) is the agent that attempt was kicked on.

Anything else is answered with a refusal and audited as task_workflow_step_report_refused. A second report for the same attempt is refused (first report wins). --result-file is read by the command, not by hive, and is capped at 16 KiB.

Timeouts and turn end

An attempt fails when:

  • it reports failed;
  • its timeout passes, measured from kicked_at;
  • its agent’s turn ends without a report: the agent’s KickOutcome settles for this attempt’s kick and report_grace passes with no report;
  • the agent is kicked again by something else before this attempt reported (a later LastKick than kicked_at), which means the session moved on;
  • the agent stops, is paused, or the kick delivery fails.

The reason is stored on the attempt (reported-failed, timeout, no-report, preempted, agent-unavailable, delivery-failed, prompt-too-long). The runner does not interrupt a timed-out agent’s session; it stops waiting for it, releases the claim once the turn settles, and retries or fails the step. A late report for a timed-out attempt is refused.

Budget

Each kick is recorded with Governor.RecordKick, so task workflow work is spend like any other. Before kicking, the runner checks the governor’s budget gate (GetState().BudgetExhausted, honouring the per-agent budget exemption the governor already applies). When the gate is closed the run moves to paused with reason budget, no new attempt starts, and attempts already running continue. When the gate reopens the run resumes where it stopped. A pause never fails a run, and pause time does not count against step timeouts of steps that have not started; the run timeout, when set, is wall-clock and does.

Restarts

Run state is written after every transition. On boot the runner reloads active runs. A running attempt whose agent turn has settled since its kick, with no report, follows the turn-end rule; one whose agent is still in that turn keeps waiting until its timeout. A queued step simply queues again. Nothing is kicked twice for the same attempt: an attempt is created, persisted, then kicked, and a crash between those leaves an attempt with no kicked_at, which is retried as a fresh delivery of the same attempt.

Triggers

All three start the same thing: a run with a params map, validated against spec.params (unknown params refused, required ones present, defaults filled). A workflow must be saved enabled to run.

  • Manual: the dashboard’s Run button, and POST /api/task-workflows/{name}/runs with {"params": {...}}, answering 202 with the run id.
  • Cron: spec.schedule (cron, required tz, optional params), parsed with the same robfig/cron parser and five-field syntax as governor cadences. If a run of the workflow is still active at the next fire time the fire is skipped and audited (task_workflow_schedule_skipped); runs of one workflow never overlap from the schedule. workflow.tasks.schedules_enabled (default true once the feature is on) stops every schedule without editing specs.
  • External schedulers: the same API, or a run-trigger token (below).

API

Under a new prefix, /api/task-workflows, rather than /api/workflows/{id}/runs: the workflow model already routes /api/workflows/{name}/{version}, so /api/workflows/x/runs would shadow a model version named runs.

Method and pathRole
GET /api/task-workflowsany authenticated
POST /api/task-workflows/validateany authenticated
GET /api/task-workflows/{name}any authenticated
PUT /api/task-workflows/{name} (save; enabled flag)owner, audited
DELETE /api/task-workflows/{name}owner, audited
GET /api/task-workflows/{name}/runs, GET /api/task-workflows/{name}/runs/{run}any authenticated
POST /api/task-workflows/{name}/runs (start)owner, audited; a merger may start one with no params (defaults only)
POST /api/task-workflows/{name}/runs/{run}/cancelmerger or owner, audited
POST /api/task-workflows/{name}/runs/{run}/rerun (same params, new run)merger or owner, audited
POST /api/task-workflows/{name}/runs/{run}/steps/{step}/approveowner, audited
GET/POST/DELETE /api/task-workflows/{name}/tokens[/{id}]owner, audited
POST /api/task-workflows/hooks/{name}/runs, GET /api/task-workflows/hooks/{name}/runs/{run}run-trigger token only

Every route answers 404 while workflow.tasks.enabled is off.

Auth

The owner routes use the existing owner check (requireOwnerRole), the same as POST /api/kick/{agent}: a server-side session, a verified hub proxy identity, or the shared dashboard token. On a hosted hive the dashboard sits behind the hub’s ingress auth, so an external caller needs a hub session for these routes; a scheduler cannot hold one.

That is why a run-trigger token exists:

  • Created by the owner per workflow, shown once, named, with an optional expiry. Hive stores only its SHA-256 hash, in a keystore-sealed file (keystore.WriteFile) under /data/task-workflows/, never in hive.yaml.
  • Scoped to one workflow and to two calls: start a run of it with params, and read the status of runs of it. It cannot save, cancel, approve, kick an agent, or read anything else.
  • Presented as Authorization: Bearer htw_<random> on the /api/task-workflows/hooks/... routes, which are the only routes that accept it. Those routes are public paths in isPublicPath only while the feature is on (the pattern used by the public knowledge MCP path), and the handler does the real authentication. On hosted hives the hooks prefix is added to the hub ingress exemptions in pkg/hub/saas_auth.go for the same reason /api/knowledge/export is: the spoke authenticates.
  • Revocable at once from the dashboard or DELETE .../tokens/{id}.
  • Every use is audited: accepted (task_workflow_token_used, with the run id) and refused (task_workflow_token_refused, with the reason: unknown, revoked, expired, wrong workflow). Refusals are rate limited per client address.
  • Rotating the keystore key re-seals the file like any other sealed file.

Outbound notification

Optional, per workflow, and off unless both the hive switch workflow.tasks.notify.enabled (default false) and a workflow’s spec.notify.url are set.

  • What is sent: a JSON POST per event: event (run.finished or step.finished), delivery_id, workflow, revision, run_id, run status, trigger kind, the step (id, status, attempt, fixed failure code) or every step’s state on run events, timestamps. State only: no params, prompts, step results, agent transcripts or credentials (as built in #20647; a receiver reads a result through the run status API). The receiver guide is Task workflow notifications.
  • Signing: X-Hive-Signature-256: sha256=<hex HMAC of the body> with a per-workflow secret generated by hive, sealed with the keystore, shown to the owner once (and re-generatable). X-Hive-Delivery carries a unique id and X-Hive-Event the event.
  • Path: sent through the egress proxy (HTTPS_PROXY) like other outbound sends, with the private-target rules used for user-supplied URLs (isPrivateURL, ssrfPinnedTransport, noRedirectToPrivate): a URL that resolves to a private or internal address is refused unless the operator lists its host in workflow.tasks.notify.allowed_private_hosts.
  • Delivery: https only (plain http to loopback only), no redirects followed, a 10s timeout per try and bounded retries with backoff, never blocking the runner; link-local and cloud metadata addresses are refused even when allowlisted. A failed delivery is recorded on the run and does not change its outcome.
  • Inventory: listed in src/docs/telemetry.md and in outboundSites (pkg/prosefilter/outbound_sites_test.go) as a machine class send site.

Persistence

Under the hive data root (/data, or HIVE_TASK_WORKFLOWS_DATA_DIR):

task-workflows/
  defs/<name>.json            the saved spec, with revision, enabled, saved_by, saved_at
  runs/<name>/<run_id>.json   one run: spec snapshot and hash, params, steps, attempts
  runs/index.json             catalogue of runs for listing
  tokens.sealed               run-trigger token hashes (keystore sealed)
  notify-secrets.sealed       per-workflow HMAC secrets (keystore sealed)

Every file carries schema_version and is written atomically (temp file, fsync, rename), as pkg/workflowmodel/store does. A run stores a copy of the spec it started with, so editing a workflow never changes a run in flight, and re-run uses the current spec. Retention is bounded: the newest workflow.tasks.retention_runs (default 50) finished runs per workflow, and none older than workflow.tasks.retention_days (default 30); active runs are never pruned.

Dashboard

Under Settings → Workflows, a Task workflows section (visible only when the feature is on):

  • the list of task workflows with enabled state, schedule, last run;
  • an editor (YAML) with live validation diagnostics, Save and Enable;
  • the runs list per workflow (status, trigger, started, duration);
  • a run detail page: the DAG drawn with the existing workflow renderer’s layered layout, each node coloured by step state, and per step its attempts, agent, durations, result, failure reason, and a link to the kick log for that attempt (the existing kick history view, by agent and kick time); Cancel and Re-run buttons, and Approve on held steps;
  • run-trigger tokens and the notification secret.

Settings → Workflows also gets a home for every workflow.tasks knob, each indexed by the settings search.

Import from Tekton and GitHub Actions

Phase (f). The ingesters already produce workflowmodel.Pipeline with Nodes and Needs. A converter turns one pipeline into a draft TaskWorkflow: each task or job becomes a step with the same id (sanitised), runAfter/needs become depends_on, finally tasks become steps that depend on every other step, and matrix jobs become one step. Agent and prompt are left empty, so the draft does not validate until the owner assigns them; it is saved only disabled. Nothing about the source pipeline is executed or fetched, and a job’s commands are not copied into prompts.

finally is imported as explicitly lossy (decision on #20648): depends_on waits for success, so the step runs only if every other step succeeded, and the import reports finally-not-guaranteed. Upstream on_failure is not rewritten. Every construct that does not map (matrix, if and when, services and containers, results and outputs, workspaces, environments, triggers, secret references) is reported as a finding with a stable code, and secret references become <secret:NAME> placeholders; no secret value is carried. The user guides list the codes: GitHub Actions, Tekton.

Safety

  • Off by default. workflow.tasks.enabled (env HIVE_WORKFLOW_TASKS_ENABLED) gates the runner, the relay, every route and the dashboard section. Off, no goroutine starts and the drop box is not created.

  • Every knob is configurable with a default equal to today’s behaviour and a Settings UI home:

    KeyDefaultEnv
    workflow.tasks.enabledfalseHIVE_WORKFLOW_TASKS_ENABLED
    workflow.tasks.max_concurrent_steps4HIVE_WORKFLOW_TASKS_MAX_CONCURRENT_STEPS
    workflow.tasks.default_step_timeout60mHIVE_WORKFLOW_TASKS_DEFAULT_STEP_TIMEOUT
    workflow.tasks.report_grace30sHIVE_WORKFLOW_TASKS_REPORT_GRACE
    workflow.tasks.schedules_enabledtrueHIVE_WORKFLOW_TASKS_SCHEDULES_ENABLED
    workflow.tasks.retention_runs50HIVE_WORKFLOW_TASKS_RETENTION_RUNS
    workflow.tasks.retention_days30HIVE_WORKFLOW_TASKS_RETENTION_DAYS
    workflow.tasks.trigger_tokens_enabledtrueHIVE_WORKFLOW_TASKS_TRIGGER_TOKENS_ENABLED
    workflow.tasks.notify.enabledfalseHIVE_WORKFLOW_TASKS_NOTIFY_ENABLED
    workflow.tasks.notify.allowed_private_hostsemptynone
  • No new agent permission. A step is a kick. What the agent can then do on GitHub or anywhere else is decided by its mode, the ACMM level, the credential helper and the egress proxy, exactly as for a kick from the dashboard. Task workflows neither widen nor bypass any of it.

  • The agent-no-human-gate rule. That Compile rule exists for workflow models, where an agent acts on a GitHub item and something must stop it reaching a terminal state (merged, released) without a person. A task workflow moves no GitHub item through states, so the rule does not apply to it, and Validate does not require a human gate. Where an agent in a step writes to GitHub, the existing gates (review, merge policy, required approvals) still sit between it and a merge.

  • Optional human gate on a step. approval: required holds the step in awaiting-approval until an owner approves it (owner-only route, audited as task_workflow_step_approved). It is the same owner role check and audit as the existing human-released gates; the dashboard shows held steps on the run page.

  • Owner actions are audited. Saving, enabling, disabling and deleting a workflow, starting, cancelling and re-running a run, approving a step, and creating or revoking a token each write an audit entry with the user.

  • Prompts are owner-authored. Only an owner can save a spec, so the text typed into agents is the owner’s, as with the kick API. Params from a run-trigger token are substituted verbatim into that text; the owner decides where params appear in prompts, and the guide says to treat them as untrusted input.

The use case, worked

A regression-pipeline use case on a pool of three Bob agents (bob-1, bob-2, bob-3, each backend: bob, cadence paused):

deploy ──▶ gen-tests ──┬──▶ test-a ──┐
                       ├──▶ test-b ──┼──▶ report
                       └──▶ test-c ──┘
apiVersion: workflow.hivecommons.dev/v1alpha1
kind: TaskWorkflow
metadata:
  name: regression
spec:
  params:
    - { name: build, required: true }
    - { name: env, default: staging }
  pools:
    bob: [bob-1, bob-2, bob-3]
  concurrency: 3
  schedule: { cron: "0 2 * * *", tz: UTC, params: { build: nightly } }
  steps:
    - id: deploy
      pool: bob
      prompt: Deploy build {{params.build}} to {{params.env}}. Result is the deployed URL.
      retry: { max_attempts: 3, backoff: 2m }
      timeout: 30m
    - id: gen-tests
      pool: bob
      depends_on: [deploy]
      prompt: Generate test cases for {{steps.deploy.result}}. Result is the test plan path.
    - id: test-a
      pool: bob
      depends_on: [gen-tests]
      prompt: Run suite A from {{steps.gen-tests.result}} against {{steps.deploy.result}}.
      on_failure: continue
    - id: test-b
      pool: bob
      depends_on: [gen-tests]
      prompt: Run suite B from {{steps.gen-tests.result}} against {{steps.deploy.result}}.
      on_failure: continue
    - id: test-c
      pool: bob
      depends_on: [gen-tests]
      prompt: Run suite C from {{steps.gen-tests.result}} against {{steps.deploy.result}}.
      on_failure: continue
    - id: report
      pool: bob
      depends_on: [test-a, test-b, test-c]
      prompt: |
        Write the regression report for build {{params.build}}.
        A: {{steps.test-a.result}}
        B: {{steps.test-b.result}}
        C: {{steps.test-c.result}}

What happens at 02:00 UTC: the schedule starts a run with build=nightly. deploy goes to bob-1. If it reports failed, or its session ends without a report, it waits 2 minutes and retries on bob-2, then after 4 minutes on bob-3. Only when an attempt reports succeeded does gen-tests become ready; if all three attempts fail the run ends failed and no test runs. After gen-tests succeeds, the three test steps start at once, one per pool member. A failing test suite does not stop the others (continue), but report depends on all three, so it is skipped if any of them failed; an owner who wants a report regardless splits it into a step without that dependency. An external CI system can start the same run with a run-trigger token:

curl -X POST https://hive.example.com/api/task-workflows/hooks/regression/runs \
  -H "Authorization: Bearer $HIVE_RUN_TOKEN" \
  -d '{"params":{"build":"1.4.2-rc1","env":"staging"}}'

Phases

Each phase is one PR, merged on green before the next depends on it.

PhaseIssueScope
design#20642this page
(a)#20643spec types, parsing, validation, templates, tests
(b)#20644run store, runner engine, hive-step-done relay, timeouts, retries, gating, budget pause
(c)#20645API, run-trigger tokens, cron schedule
(d)#20646dashboard runs UI, Settings knobs, settings-search index
(e)#20647outbound notification
(f)#20648Tekton and GitHub Actions import to a draft
(g)#20649user guide src/docs/task-workflows.md

Alternatives considered

  • An external dispatcher over the kick API. Works today, but completion is a guess from kick-outcomes, there is no structured result, and every adopter rebuilds retries and gating. Rejected as the answer; still possible.
  • Executing ingested Tekton or Actions pipelines. Their tasks are container steps, not agent prompts, and the model treats them as observed facts. Converting their shape (phase f) gives the DAG without pretending to run CI.
  • Extending WorkflowModel with executable steps. Its states, guards and Compile rules are about GitHub items; mixing a run engine into it would change the meaning of saved models. A separate kind in the same group keeps both clear.
  • A network callback for completion. Would need a token in the prompt and a listener reachable from agents (and from sandboxes). The request-file pattern already carries identity (UID or spool manifest) and is how agents hand work back to hive everywhere else.