Files
archie/internal/domain/workflow/task/caller.go
T
sam 678bf82961 feat(workflow): declared workflow outputs for wait:true callers
A workflow declares named, typed outputs beside its inputs
(task.WorkflowInterface.Outputs). A run writes each one once through a
capture tool named after the output, or from a deterministic Go stage via
TaskContext.WriteOutput; the finish write persists them on tasks.outputs
before the outcome transition. A wait:true caller receives its successful
callee's outputs through WorkflowCallStatus and publishes one as its own
through a call step's outputs assignment.

Build authority: docs/prds/workflow-call-outputs.md.

- save time: WorkflowInterface.Validate checks output names and types;
  checkCallOutputs checks a call's assignment against both declarations
  and refuses outputs over a wait:false call.
- run time: undeclared, mistyped and required-but-missing values park the
  run; published callee values are re-checked against the caller's type.
- storage/wire: tasks.outputs (goose 0024), reset by each claim so the set
  is attempt-scoped; an encoded set past the structured-payload bound is
  refused, not clipped. Task.outputs_json and
  WorkflowCallStatusResponse.outputs_json carry it; task.Caller keeps its
  two methods.
- examples: firewall-contain calls firewall-investigate and publishes its
  summary as its own output.
2026-10-02 02:09:03 +10:00

25 lines
1.3 KiB
Go

package task
import "context"
// Caller is what a workflow.call step uses to start a callee run and read it
// back while waiting. It is the consumer-owned contract the workflow engine
// holds (the same shape as Store), satisfied by *staterpc.Client for an
// agent-container run: the callee is a first-class task the State Store
// derives from the caller's row (docs/prds/workflow-calls.md).
type Caller interface {
// StartCall enqueues the callee task for callerTaskID's workflow.call
// step: org, workspace, identity, owner, repo and issue number are
// derived from the caller's row, the callee carries the call's inputs,
// and the callee's depth is the caller's + 1. The store refuses a
// caller that is not running and a call past the depth limit.
StartCall(ctx context.Context, callerTaskID int64, workflow string, inputs map[string]any) (*Task, error)
// CallStatus reads one call's callee: its status, latest transition
// detail and written outputs (decoded from the callee's row;
// docs/prds/workflow-call-outputs.md, "Storage and wire" — the callee
// writes them and the caller only receives them). A store only answers
// for a task whose call_parent_task_id is callerTaskID, so a caller
// reads only its own callees.
CallStatus(ctx context.Context, callerTaskID, callTaskID int64) (status, detail string, outputs map[string]any, err error)
}