feat(eda): workflow inputs, optional repository and agent profiles

Workflow definitions declare inputs, repository (none, optional or
required; default required) and profile. A binding assigns each input
from a mapped parameter or a constant and may take its repository from a
parameter, which must name a configured repo; both are checked when the
binding is saved and again at dispatch. Inputs travel as structured task
data (tasks.inputs, the task brief, and a JSON block in the agent's
mission), never as body text.

A task with no repository runs in a per-task scratch workspace with no
clone and no publication grant. The agent.run step runs one mission
without a repository and finishes the task in the new completed status.

Agent profiles live under [containers.profiles.<name>]: an image and an
allowlist over the tools archie adds (MCP, scripts, plugins).
[containers].image is the default profile; an unconfigured profile parks
the task. The workflow is now pinned before the container starts so the
profile can choose its image.

Also stop two archied tests writing embedded NATS state into the package
directory, refuse an empty state_dir for embedded NATS, and drop the NATS
store files an earlier lane commit tracked.
This commit is contained in:
sam committed 2026-09-24 20:29:33 +10:00
1 parent 7181e7917d
commit c431834e2b
118 files changed
+2163 -327

No files matched your search

+64 -23
View File
@@ -301,7 +301,11 @@ func (s *EDA) RecordMappingMatch(ctx context.Context, mappingID, captureID strin
// bindingValue takes GetBindingRow; the list queries' rows share its fields
// and convert to it.
func bindingValue(r postgresdb.GetBindingRow) binding.Binding {
func bindingValue(r postgresdb.GetBindingRow) (binding.Binding, error) {
var inputs map[string]binding.InputSource
if err := json.Unmarshal([]byte(r.Inputs), &inputs); err != nil {
return binding.Binding{}, fmt.Errorf("edastore: decode binding %s inputs: %w", r.ID, err)
}
return binding.Binding{
ID: r.ID,
Name: r.Name,
@@ -311,27 +315,47 @@ func bindingValue(r postgresdb.GetBindingRow) binding.Binding {
Workflow: r.Workflow,
Owner: r.Owner,
Repo: r.Repo,
RepoParam: r.RepoParam,
Inputs: inputs,
Version: int(r.Version),
Status: binding.Status(r.Status),
CreatedAt: r.CreatedAt,
UpdatedAt: r.UpdatedAt,
}, nil
}
// bindingInputs encodes a binding's input assignments for storage.
func bindingInputs(b binding.Binding) (string, error) {
if len(b.Inputs) == 0 {
return "{}", nil
}
data, err := json.Marshal(b.Inputs)
if err != nil {
return "", fmt.Errorf("edastore: encode binding inputs: %w", err)
}
return string(data), nil
}
// InsertBinding stores a new binding as pending_approval. Any number of
// bindings may share a source.
func (s *EDA) InsertBinding(ctx context.Context, b binding.Binding) (string, error) {
id := newRecordID()
err := s.q.InsertBinding(ctx, postgresdb.InsertBindingParams{
ID: id,
Name: b.Name,
Source: b.Matcher.Source,
Mapping: b.MappingID,
Filter: b.Filter,
Workflow: b.Workflow,
Owner: b.Owner,
Repo: b.Repo,
Status: string(binding.StatusPendingApproval),
inputs, err := bindingInputs(b)
if err != nil {
return "", err
}
err = s.q.InsertBinding(ctx, postgresdb.InsertBindingParams{
ID: id,
Name: b.Name,
Source: b.Matcher.Source,
Mapping: b.MappingID,
Filter: b.Filter,
Workflow: b.Workflow,
Owner: b.Owner,
Repo: b.Repo,
Status: string(binding.StatusPendingApproval),
Inputs: inputs,
RepoParam: b.RepoParam,
})
if err != nil {
return "", fmt.Errorf("edastore: insert binding: %w", err)
@@ -350,7 +374,10 @@ func (s *EDA) GetBinding(ctx context.Context, id string) (*binding.Binding, erro
if err != nil {
return nil, err
}
b := bindingValue(r)
b, err := bindingValue(r)
if err != nil {
return nil, err
}
return &b, nil
}
@@ -361,7 +388,11 @@ func (s *EDA) ListBindings(ctx context.Context) ([]binding.Binding, error) {
}
out := make([]binding.Binding, 0, len(rows))
for _, r := range rows {
out = append(out, bindingValue(postgresdb.GetBindingRow(r)))
b, err := bindingValue(postgresdb.GetBindingRow(r))
if err != nil {
return nil, err
}
out = append(out, b)
}
return out, nil
}
@@ -374,7 +405,11 @@ func (s *EDA) ArmedBindingsForSource(ctx context.Context, source string) ([]bind
}
out := make([]binding.Binding, 0, len(rows))
for _, r := range rows {
out = append(out, bindingValue(postgresdb.GetBindingRow(r)))
b, err := bindingValue(postgresdb.GetBindingRow(r))
if err != nil {
return nil, err
}
out = append(out, b)
}
return out, nil
}
@@ -382,16 +417,22 @@ func (s *EDA) ArmedBindingsForSource(ctx context.Context, source string) ([]bind
// UpdateBinding rewrites a binding's editable fields, bumps its version and
// drops it back to pending_approval.
func (s *EDA) UpdateBinding(ctx context.Context, b binding.Binding) error {
inputs, err := bindingInputs(b)
if err != nil {
return err
}
n, err := s.q.UpdateBinding(ctx, postgresdb.UpdateBindingParams{
ID: b.ID,
Name: b.Name,
Source: b.Matcher.Source,
Mapping: b.MappingID,
Filter: b.Filter,
Workflow: b.Workflow,
Owner: b.Owner,
Repo: b.Repo,
Status: string(binding.StatusPendingApproval),
ID: b.ID,
Name: b.Name,
Source: b.Matcher.Source,
Mapping: b.MappingID,
Filter: b.Filter,
Workflow: b.Workflow,
Owner: b.Owner,
Repo: b.Repo,
Status: string(binding.StatusPendingApproval),
Inputs: inputs,
RepoParam: b.RepoParam,
})
if err != nil {
return err
@@ -0,0 +1,21 @@
-- Workflow inputs and bindings that assign them
-- (docs/prds/event-automation.md, "Workflows declare inputs" and "Bindings").
--
-- bindings.inputs is a JSON object assigning each workflow input either a
-- mapped parameter ({"param": "src_ip"}) or a constant ({"value": 3}).
-- bindings.repo_param names the mapped parameter holding "owner/name" when the
-- repository comes from the event rather than a fixed owner/repo.
-- tasks.inputs is the JSON object of input values a binding dispatch resolved;
-- empty for a task no binding started.
-- +goose Up
ALTER TABLE bindings ADD COLUMN inputs text NOT NULL DEFAULT '{}';
ALTER TABLE bindings ADD COLUMN repo_param text NOT NULL DEFAULT '';
ALTER TABLE tasks ADD COLUMN inputs text NOT NULL DEFAULT '';
-- +goose Down
ALTER TABLE tasks DROP COLUMN inputs;
ALTER TABLE bindings DROP COLUMN repo_param;
ALTER TABLE bindings DROP COLUMN inputs;
@@ -11,7 +11,7 @@ import (
)
const armedBindingsForSource = `-- name: ArmedBindingsForSource :many
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter, inputs, repo_param
FROM bindings WHERE source = $1 AND status = 'armed' ORDER BY created_at DESC
`
@@ -28,6 +28,8 @@ type ArmedBindingsForSourceRow struct {
CreatedAt time.Time
UpdatedAt time.Time
Filter string
Inputs string
RepoParam string
}
func (q *Queries) ArmedBindingsForSource(ctx context.Context, source string) ([]ArmedBindingsForSourceRow, error) {
@@ -52,6 +54,8 @@ func (q *Queries) ArmedBindingsForSource(ctx context.Context, source string) ([]
&i.CreatedAt,
&i.UpdatedAt,
&i.Filter,
&i.Inputs,
&i.RepoParam,
); err != nil {
return nil, err
}
@@ -171,7 +175,7 @@ func (q *Queries) EventTypesForSource(ctx context.Context, source string) ([]Eve
}
const getBinding = `-- name: GetBinding :one
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter, inputs, repo_param
FROM bindings WHERE id = $1
`
@@ -188,6 +192,8 @@ type GetBindingRow struct {
CreatedAt time.Time
UpdatedAt time.Time
Filter string
Inputs string
RepoParam string
}
func (q *Queries) GetBinding(ctx context.Context, id string) (GetBindingRow, error) {
@@ -206,6 +212,8 @@ func (q *Queries) GetBinding(ctx context.Context, id string) (GetBindingRow, err
&i.CreatedAt,
&i.UpdatedAt,
&i.Filter,
&i.Inputs,
&i.RepoParam,
)
return i, err
}
@@ -278,20 +286,22 @@ func (q *Queries) GetSource(ctx context.Context, path string) (Source, error) {
}
const insertBinding = `-- name: InsertBinding :exec
INSERT INTO bindings (id, name, source, mapping, filter, workflow, owner, repo, version, status)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, 1, $9)
INSERT INTO bindings (id, name, source, mapping, filter, workflow, owner, repo, version, status, inputs, repo_param)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, 1, $9, $10, $11)
`
type InsertBindingParams struct {
ID string
Name string
Source string
Mapping string
Filter string
Workflow string
Owner string
Repo string
Status string
ID string
Name string
Source string
Mapping string
Filter string
Workflow string
Owner string
Repo string
Status string
Inputs string
RepoParam string
}
func (q *Queries) InsertBinding(ctx context.Context, arg InsertBindingParams) error {
@@ -305,6 +315,8 @@ func (q *Queries) InsertBinding(ctx context.Context, arg InsertBindingParams) er
arg.Owner,
arg.Repo,
arg.Status,
arg.Inputs,
arg.RepoParam,
)
return err
}
@@ -496,7 +508,7 @@ func (q *Queries) InsertToolCall(ctx context.Context, arg InsertToolCallParams)
}
const listBindings = `-- name: ListBindings :many
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter, inputs, repo_param
FROM bindings ORDER BY created_at DESC
`
@@ -513,6 +525,8 @@ type ListBindingsRow struct {
CreatedAt time.Time
UpdatedAt time.Time
Filter string
Inputs string
RepoParam string
}
func (q *Queries) ListBindings(ctx context.Context) ([]ListBindingsRow, error) {
@@ -537,6 +551,8 @@ func (q *Queries) ListBindings(ctx context.Context) ([]ListBindingsRow, error) {
&i.CreatedAt,
&i.UpdatedAt,
&i.Filter,
&i.Inputs,
&i.RepoParam,
); err != nil {
return nil, err
}
@@ -861,20 +877,22 @@ func (q *Queries) TaskToolCalls(ctx context.Context, taskID int64) ([]TaskToolCa
const updateBinding = `-- name: UpdateBinding :execrows
UPDATE bindings
SET name = $2, source = $3, mapping = $4, filter = $5, workflow = $6, owner = $7, repo = $8,
version = version + 1, status = $9, updated_at = now()
version = version + 1, status = $9, inputs = $10, repo_param = $11, updated_at = now()
WHERE id = $1
`
type UpdateBindingParams struct {
ID string
Name string
Source string
Mapping string
Filter string
Workflow string
Owner string
Repo string
Status string
ID string
Name string
Source string
Mapping string
Filter string
Workflow string
Owner string
Repo string
Status string
Inputs string
RepoParam string
}
func (q *Queries) UpdateBinding(ctx context.Context, arg UpdateBindingParams) (int64, error) {
@@ -888,6 +906,8 @@ func (q *Queries) UpdateBinding(ctx context.Context, arg UpdateBindingParams) (i
arg.Owner,
arg.Repo,
arg.Status,
arg.Inputs,
arg.RepoParam,
)
if err != nil {
return 0, err
@@ -30,6 +30,8 @@ type Binding struct {
CreatedAt time.Time
UpdatedAt time.Time
Filter string
Inputs string
RepoParam string
}
type BindingDispatch struct {
@@ -251,6 +253,7 @@ type Task struct {
CreatedAt time.Time
UpdatedAt time.Time
ReviewCursor int64
Inputs string
}
type ToolCall struct {
@@ -48,7 +48,7 @@ func (q *Queries) BeginRemediationTask(ctx context.Context, arg BeginRemediation
const claimByIssue = `-- name: ClaimByIssue :one
UPDATE tasks SET status = 'running', attempt = attempt + 1, updated_at = now()
WHERE owner = $1 AND repo = $2 AND issue_number = $3 AND status = 'queued'
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, stage, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, stage, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs
`
type ClaimByIssueParams struct {
@@ -94,6 +94,7 @@ func (q *Queries) ClaimByIssue(ctx context.Context, arg ClaimByIssueParams) (Tas
&i.CreatedAt,
&i.UpdatedAt,
&i.ReviewCursor,
&i.Inputs,
)
return i, err
}
@@ -108,7 +109,7 @@ WHERE id = (
FOR UPDATE SKIP LOCKED
LIMIT 1
)
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, stage, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, stage, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs
`
// FOR UPDATE SKIP LOCKED replaces the SQLite single-writer assumption: two
@@ -151,6 +152,7 @@ func (q *Queries) ClaimNextTask(ctx context.Context) (Task, error) {
&i.CreatedAt,
&i.UpdatedAt,
&i.ReviewCursor,
&i.Inputs,
)
return i, err
}
@@ -241,7 +243,7 @@ VALUES (
), $3) + 1,
$4, $5, 'chat', $6, 'chat', $7
)
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, stage, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, stage, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs
`
type InsertChatTaskParams struct {
@@ -303,6 +305,7 @@ func (q *Queries) InsertChatTask(ctx context.Context, arg InsertChatTaskParams)
&i.CreatedAt,
&i.UpdatedAt,
&i.ReviewCursor,
&i.Inputs,
)
return i, err
}
@@ -556,22 +559,28 @@ func (q *Queries) SetReviewCursors(ctx context.Context, arg SetReviewCursorsPara
}
const stampTaskBinding = `-- name: StampTaskBinding :exec
UPDATE tasks SET binding_id = $2, binding_version = $3 WHERE id = $1
UPDATE tasks SET binding_id = $2, binding_version = $3, inputs = $4 WHERE id = $1
`
type StampTaskBindingParams struct {
ID int64
BindingID string
BindingVersion int64
Inputs string
}
func (q *Queries) StampTaskBinding(ctx context.Context, arg StampTaskBindingParams) error {
_, err := q.db.Exec(ctx, stampTaskBinding, arg.ID, arg.BindingID, arg.BindingVersion)
_, err := q.db.Exec(ctx, stampTaskBinding,
arg.ID,
arg.BindingID,
arg.BindingVersion,
arg.Inputs,
)
return err
}
const taskByID = `-- name: TaskByID :one
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, stage, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor FROM tasks WHERE id = $1
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, stage, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs FROM tasks WHERE id = $1
`
func (q *Queries) TaskByID(ctx context.Context, id int64) (Task, error) {
@@ -611,12 +620,13 @@ func (q *Queries) TaskByID(ctx context.Context, id int64) (Task, error) {
&i.CreatedAt,
&i.UpdatedAt,
&i.ReviewCursor,
&i.Inputs,
)
return i, err
}
const taskByIssue = `-- name: TaskByIssue :one
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, stage, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor FROM tasks WHERE owner = $1 AND repo = $2 AND issue_number = $3
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, stage, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs FROM tasks WHERE owner = $1 AND repo = $2 AND issue_number = $3
`
type TaskByIssueParams struct {
@@ -662,12 +672,13 @@ func (q *Queries) TaskByIssue(ctx context.Context, arg TaskByIssueParams) (Task,
&i.CreatedAt,
&i.UpdatedAt,
&i.ReviewCursor,
&i.Inputs,
)
return i, err
}
const taskByPR = `-- name: TaskByPR :one
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, stage, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor FROM tasks WHERE owner = $1 AND repo = $2 AND pr_number = $3 AND status = $4
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, stage, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs FROM tasks WHERE owner = $1 AND repo = $2 AND pr_number = $3 AND status = $4
`
type TaskByPRParams struct {
@@ -722,6 +733,7 @@ func (q *Queries) TaskByPR(ctx context.Context, arg TaskByPRParams) (Task, error
&i.CreatedAt,
&i.UpdatedAt,
&i.ReviewCursor,
&i.Inputs,
)
return i, err
}
@@ -63,25 +63,25 @@ ON CONFLICT DO NOTHING;
DELETE FROM mappings WHERE id = $1;
-- name: InsertBinding :exec
INSERT INTO bindings (id, name, source, mapping, filter, workflow, owner, repo, version, status)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, 1, $9);
INSERT INTO bindings (id, name, source, mapping, filter, workflow, owner, repo, version, status, inputs, repo_param)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, 1, $9, $10, $11);
-- name: GetBinding :one
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter, inputs, repo_param
FROM bindings WHERE id = $1;
-- name: ListBindings :many
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter, inputs, repo_param
FROM bindings ORDER BY created_at DESC;
-- name: ArmedBindingsForSource :many
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter, inputs, repo_param
FROM bindings WHERE source = $1 AND status = 'armed' ORDER BY created_at DESC;
-- name: UpdateBinding :execrows
UPDATE bindings
SET name = $2, source = $3, mapping = $4, filter = $5, workflow = $6, owner = $7, repo = $8,
version = version + 1, status = $9, updated_at = now()
version = version + 1, status = $9, inputs = $10, repo_param = $11, updated_at = now()
WHERE id = $1;
-- name: SetBindingArmed :execrows
@@ -56,7 +56,7 @@ VALUES (
RETURNING *;
-- name: StampTaskBinding :exec
UPDATE tasks SET binding_id = $2, binding_version = $3 WHERE id = $1;
UPDATE tasks SET binding_id = $2, binding_version = $3, inputs = $4 WHERE id = $1;
-- name: UpdateTask :exec
UPDATE tasks SET workflow = $2, stage = $3, branch = $4, plan = $5, notes = $6,
+12 -2
View File
@@ -11,6 +11,7 @@ import (
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/workflow"
workflowtask "github.com/samcharles93/archie-core/internal/domain/workflow/task"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/postgresdb"
"github.com/samcharles93/archie-core/internal/taskstate"
@@ -48,6 +49,9 @@ const syntheticIssueNumberBase = 1_000_000_000_000_000
// taskFromRow maps the generated task row to the workflow.Task the daemon and
// webui consume.
func taskFromRow(t postgresdb.Task) *workflow.Task {
// The inputs column is only ever written by EncodeInputs, so a decode
// failure cannot arise from stored data this package produced.
inputs, _ := workflowtask.DecodeInputs(t.Inputs)
return &workflow.Task{
ID: t.ID,
Owner: t.Owner,
@@ -77,6 +81,7 @@ func taskFromRow(t postgresdb.Task) *workflow.Task {
Identity: t.Identity,
BindingID: t.BindingID,
BindingVersion: int(t.BindingVersion),
Inputs: inputs,
ReviewPayload: t.ReviewPayload,
ParkClass: t.ParkClass,
RemediationRounds: int(t.RemediationRounds),
@@ -124,18 +129,23 @@ func (s *Store) EnqueueChatTask(ctx context.Context, owner, repo, title, body, w
// EnqueueBindingTask enqueues a binding-triggered task and stamps its binding
// provenance in a second statement (best-effort, as in the SQLite store).
func (s *Store) EnqueueBindingTask(ctx context.Context, owner, repo, title, body, wf, identity, bindingID string, bindingVersion int) (*workflow.Task, error) {
func (s *Store) EnqueueBindingTask(ctx context.Context, owner, repo, title, body, wf, identity, bindingID string, bindingVersion int, inputs map[string]any) (*workflow.Task, error) {
encoded, err := workflowtask.EncodeInputs(inputs)
if err != nil {
return nil, err
}
t, err := s.EnqueueChatTask(ctx, owner, repo, title, body, wf, identity)
if err != nil {
return nil, err
}
if err := s.queries().StampTaskBinding(ctx, postgresdb.StampTaskBindingParams{
ID: t.ID, BindingID: bindingID, BindingVersion: int64(bindingVersion),
ID: t.ID, BindingID: bindingID, BindingVersion: int64(bindingVersion), Inputs: encoded,
}); err != nil {
return nil, fmt.Errorf("store: stamp binding provenance: %w", err)
}
t.BindingID = bindingID
t.BindingVersion = bindingVersion
t.Inputs = inputs
return t, nil
}