Changeset 0.27.3 (#170)

This commit is contained in:
2026-03-11 09:12:57 +00:00
parent dcb915555e
commit a46ec63464
14 changed files with 561 additions and 110 deletions

View File

@@ -1,5 +1,62 @@
# Changelog
## [0.27.3] — 2026-03-10
### Summary
Task chaining — webhooks for external integration, AI-spawnable sub-tasks,
and workflow-to-workflow completion triggers. Also fixes a bug where the
`workflow_advance` tool didn't fire `on_complete` chains.
### Added
#### Webhook Delivery (`server/webhook/`)
- **`webhook.Deliver(url, secret, payload)`** — POST with HMAC-SHA256 signing.
3 retries with exponential backoff (1s, 5s, 25s), 10s timeout per attempt.
`X-Switchboard-Signature` header for verification.
- **`webhook.GenerateSecret()`** — 32-byte hex random secret, auto-generated
on task creation when `webhook_url` is set.
- **`webhook.Payload`** struct: task_id, task_name, workflow_id, channel_id,
status, completed_at, output, stage_data, error.
#### Task Webhooks
- Task executor fires webhook on completion, failure, and budget breach.
Runs in a goroutine — non-blocking.
- `webhook_secret` column on tasks table (migration 027).
- Secret auto-generated in task handler `Create` when `webhook_url` is provided.
#### Workflow Webhooks
- `webhook_url` and `webhook_secret` columns on workflows table (migration 027).
- Webhook delivered on workflow completion (both handler and tool paths).
#### `task_create` Tool
- AI-invocable tool that spawns sub-tasks from workflow/team contexts.
- **Predicates:** available in workflow channels and team channels only.
Blocked in service channels (prevents recursive task spawning).
- **Scope inheritance:** created tasks inherit parent channel's team scope.
- **Depth limit:** service channel check prevents tasks creating tasks.
- Parameters: name, prompt, schedule (cron or "once"), persona, model,
max_tokens, system_prompt. Validates cron before creation.
#### Workflow `on_complete` Chaining Extraction
- `TriggerWorkflowOnComplete()` extracted to `tools/workflow.go` as shared
function. Used by both HTTP handler and `workflow_advance` tool.
- Handles both `on_complete` chain config and webhook delivery.
### Fixed
- **`workflow_advance` tool completion path** now triggers `on_complete`
chaining. Previously only the HTTP `Advance` endpoint fired chains —
AI-driven stage advancement silently skipped them.
### Changed
- `Workflow` model gains `WebhookURL`, `WebhookSecret` fields.
- `WorkflowPatch` gains `WebhookURL` field.
- `Task` model gains `WebhookSecret` field.
- `workflow_instances.go` `triggerOnComplete` method replaced with
one-line delegation to shared `tools.TriggerWorkflowOnComplete()`.
## [0.27.2] — 2026-03-10
### Summary