* feat(state): durable operator alerts owned by the State Store Alerts dedup on org+kind+subject, resolve themselves when a condition clears, and are raised, resolved, dismissed and listed through the state contract. Task transitions raise needs-human and failed alerts in the same transaction; the store checks service health and prunes closed alerts. Each raise and resolve queues a webhook delivery whose attempts are kept. * feat(notify): deliver operator alerts to the webhook; raise config and release alerts notify.webhook now receives raised and resolved alerts above a severity threshold with HMAC-signed payloads, bounded retry and every attempt recorded on the alert. archied raises model alias, provider and credential-binding alerts from the effective configuration, an update alert from the release channel, and a credential-rejected alert from the egress resolver. The dashboard API lists and dismisses the caller's org's alerts. * feat(ui): alert bell in the top bar and webhook alert settings The bell lists the org's open alerts by severity with dismiss and a link per alert, and refreshes from the event stream. The task settings page gains the webhook severity threshold and signing secret. ui/dist rebuilt.
29 lines
962 B
Go
29 lines
962 B
Go
package workflow
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
// notify posts a one-way notice on a forge-backed task's issue. The operator
|
|
// alert for the task waiting on a human is raised by the State Store when the
|
|
// task parks.
|
|
func notify(ctx context.Context, tc *TaskContext, kind string) {
|
|
if tc.Task.IsForgeBacked() {
|
|
if _, err := tc.Forge.Comment(ctx, tc.Task.Owner, tc.Task.Repo, tc.Task.IssueNumber, deliveryNotice(tc, kind)); err != nil {
|
|
tc.Log.Warn("delivery notice not posted",
|
|
"kind", kind, "issue", tc.Task.IssueNumber, "err", err)
|
|
}
|
|
}
|
|
}
|
|
|
|
// deliveryNotice is the body of the one-way notice notify posts on a
|
|
// forge-backed task's issue.
|
|
func deliveryNotice(tc *TaskContext, kind string) string {
|
|
subject := "archie finished a run that needs you"
|
|
if kind == "approval" {
|
|
subject = "archie's PRD is ready -- awaiting your go/no-go"
|
|
}
|
|
return fmt.Sprintf("**%s.**\n\n%s\n\n_Decide in chat or on the dashboard._", subject, tc.Task.Plan)
|
|
}
|