Merge branch 'main' into pipelines/run-20261112-0138-sync-open-chats-across-devices-on-the-se-9f86

# Conflicts:
#	app/lib/features/chat/chat_screen_keys.dart
#	app/lib/features/chat/chat_screen_workspace.dart
This commit is contained in:
2026-11-12 03:00:02 +00:00
140 changed files with 5332 additions and 839 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ explain the gap; ask before authoring. Do not add a task-specific pipeline as a
## Authoring
Start from `pipelines templates` and `pipelines new NAME --template KEY`
(`one-stage`, `two-stages`, `feedback-loop`, `human-decision`); these fill in
(`research`, `task`); these fill in
the server's provider/model. Read `references/format.md` and
`references/practices.md` before writing prompts. Stage names: `plan` ·
`implement` · `review` · `ui-review` · `decide` (human) · `land`.
+2 -3
View File
@@ -147,8 +147,8 @@ failing else, and `set +e`. Cover every language the run can change.
## Human stages
`type=human` pauses the run until a person picks one of its non-`error` edges
(e.g. `approve -> act`, `revise -> plan`, `abort -> #failure`; see the
`human-decision` template). It needs only `prompt` (operator instructions),
(e.g. `approve -> act`, `revise -> plan`, `abort -> #failure`). It needs only
`prompt` (operator instructions),
`configs` with `type=human` and `edges`; no model or tools. Decide with
`pipelines decide RUN_ID [STAGE] --option KEY [--feedback TEXT]` or the apps. The
wait survives restarts and is never killed by a stage timeout or `max_visits`.
@@ -185,4 +185,3 @@ once. A run started inside a linked worktree (an item's tree) and every retry
use their directory as is. After a successful run whose tree is clean and
whose branch is on `main`, the server removes the tree and branch; anything
else (a failed run, unlanded commits, stray files) is kept for recovery.
@@ -93,10 +93,12 @@ produce the required three strings, so adding this stage alone cannot cover it.
Independently of any `notify` block, the server publishes one run-level attention
notification to the same already-configured `system` destination when a run needs a
person: when it enters `waiting` (a human stage asked for a decision) and when it
fails. Nothing else notifies — a queued, running, succeeded, canceled or interrupted
run sends nothing. You do not author these; they are the operator default, so a run
you never wired still reaches the operator.
person: when it enters `waiting` (a human stage asked for a decision), or when it
fails or is interrupted. An auto-mode run always notifies for failure/interruption;
a successful auto-mode run notifies only when the operator enables `run_finished`.
Runs marked `on` notify at completion, while `off` disables these notifications.
Queued and running runs send nothing. You do not author these; they are the operator
default, so a run you never wired still reaches the operator.
The payload names the run and its pipeline. When the operator configures
`PIPELINES_WEB_PUBLIC_URL` on the server, run notifications and stage hooks carry
@@ -10,8 +10,8 @@ parallel/distributed task engine or a guarantee that model reports are correct.
- Drafts are editable Markdown plus JSON metadata. Publishing validates and creates
immutable versions; drafts remain retained. Keep context create-only/base-version
guards. The four generic examples (one-stage, two-stages, feedback-loop,
human-decision) are the template set; a brand-new database is seeded with them
guards. The two generic starters (research and task) are the template set; a
brand-new database is seeded with them
once, and an existing or already-seeded database never is. Templates can be created directly with
an editable prefilled name or customized first. Editing a bundled repository
template changes no installed or published definition; only explicit authoring
+1 -1
View File
@@ -122,7 +122,7 @@ func (a App) flags(command string) (*flag.FlagSet, *options) {
f.BoolVar(&o.noOpen, "no-open", false, "Create the draft without opening the configured harness")
f.StringVar(&o.opencode, "opencode", envOr("PIPELINES_OPENCODE", "opencode"), "Host OpenCode executable")
if command == "new" {
f.StringVar(&o.template, "template", "", "Optional template key; omitted starts a one-stage draft")
f.StringVar(&o.template, "template", "", "Optional template key; omitted starts a single-stage draft")
}
if command == "edit" {
f.IntVar(&o.version, "version", 0, "Source version (0 = latest)")
+2 -2
View File
@@ -96,7 +96,7 @@ func TestCLIStatusAndStatistics(t *testing.T) {
func TestCLIDraftValidateSubmitAndImmutableHistory(t *testing.T) {
run, store, _ := setup(t)
output, err := run("new", "example", "--template", "one-stage", "--json")
output, err := run("new", "example", "--template", "research", "--json")
if err != nil {
t.Fatal(err)
}
@@ -171,7 +171,7 @@ func TestCLIDraftValidateSubmitAndImmutableHistory(t *testing.T) {
if items[0].Version != 3 {
t.Fatal("invalid submission changed live version", items)
}
for _, command := range [][]string{{"list", "--json"}, {"show", "example", "--json"}, {"templates", "--json"}, {"template", "one-stage", "--source"}, {"drafts", "--json"}, {"runs", "--json"}, {"connection", "--json"}, {"ping"}} {
for _, command := range [][]string{{"list", "--json"}, {"show", "example", "--json"}, {"templates", "--json"}, {"template", "research", "--source"}, {"drafts", "--json"}, {"runs", "--json"}, {"connection", "--json"}, {"ping"}} {
if _, err = run(command...); err != nil {
t.Fatal(command, err)
}
+1 -1
View File
@@ -48,7 +48,7 @@ var notes = map[string]string{
"status": "Reports server, host and ntfy publishing health. The client compares its build/protocol against the server and warns once (or fails on a newer protocol) rather than proceeding silently.",
"export": "Without a name, select pipelines with Space and save a ZIP in the current directory. --output writes a portable definition bundle; --all skips selection. One name without --output prints Markdown as before. No runs, credentials or old versions are exported.",
"import": "Select definitions from a ZIP. Identical existing definitions are skipped. For differing names, choose keep existing, keep both under a new name, or use imported as a new version (history retained). --on-conflict supplies an explicit automation policy; --yes only approves final publication. Schedules may activate; no run history is imported.",
"new": "Create an optional template copy or a one-stage starter. Opens the configured default harness; --harness opencode|pi|nvim overrides it. No submission is performed.",
"new": "Create an optional template copy or a single-stage starter. Opens the configured default harness; --harness opencode|pi|nvim overrides it. No submission is performed.",
"edit": "Omit the name to open fuzzy selection. Original immutable source is copied to a private draft. The configured harness edits that draft, never the live definition.",
"validate": "Uses the same server parser as submission. Does not persist or activate schedules. Structural validity does not prove runtime/tool availability.",
"submit": "Confirm publication at the prompt, or use --yes for explicit automation; schedules activate on acceptance. Managed drafts provide the name and base-version guard. --force never bypasses validation.",
+1 -1
View File
@@ -80,7 +80,7 @@ Examples:
Authoring examples — use only when the operator explicitly requested a definition change:
pipelines edit "bug fix" "Add a review step"
pipelines new "release notes" "Summarize changes and notify my phone"
pipelines new "Add a feature" --template feedback-loop --no-open --json --yes
pipelines new "Add a feature" --template task --no-open --json --yes
pipelines validate /path/to/draft.md --json
pipelines submit /path/to/draft.md
+1 -1
View File
@@ -10,7 +10,7 @@ import (
)
func TestShowcaseDefinitions(t *testing.T) {
for _, name := range []string{"one-stage", "two-stages", "feedback-loop", "human-decision"} {
for _, name := range []string{"research", "task"} {
t.Run(name, func(t *testing.T) {
source, err := os.ReadFile(filepath.Join("..", "..", "examples", name+".md"))
if err != nil {
@@ -78,9 +78,8 @@ func TestNotificationSettingsRejectUnknownOrInvalid(t *testing.T) {
}
}
// A run's end (succeeded or failed) enqueues its generic alert only for a run
// marked "on", or for "auto" when run_finished (default off) opts into every
// run end. Waiting notifies auto and on runs regardless; "off" never notifies.
// Failed runs always enqueue their generic alert (unless off). Successful runs
// require "on" or run_finished. Waiting notifies auto and on runs regardless.
func TestRunEndEnqueueFollowsNotifyModeAndRunFinished(t *testing.T) {
for _, status := range []string{"succeeded", "failed", "waiting"} {
for _, tc := range []struct {
@@ -91,6 +90,9 @@ func TestRunEndEnqueueFollowsNotifyModeAndRunFinished(t *testing.T) {
{"auto", false, 0}, {"auto", true, 1}, {"on", false, 1}, {"on", true, 1}, {"off", false, 0}, {"off", true, 0},
} {
want := tc.want
if status == "failed" && tc.mode == "auto" {
want = 1
}
if status == "waiting" && tc.mode == "auto" {
want = 1
}
@@ -138,7 +140,7 @@ func TestLegacyRunFinishedValueIsIgnored(t *testing.T) {
if err := notificationTransition(ctx, s, id, "failed"); err != nil {
t.Fatal(err)
}
if got, err := s.RunNotifications(ctx, id); err != nil || len(got) != 0 {
if got, err := s.RunNotifications(ctx, id); err != nil || len(got) != 1 {
t.Fatalf("notifications = %+v, %v", got, err)
}
}
@@ -144,10 +144,10 @@ func TestRunNotificationTransitionModesAndCoverage(t *testing.T) {
if err != nil {
t.Fatal(err)
}
// run_finished defaults off, so an auto run notifies only
// while waiting; its end is silent unless marked "on".
// Failed runs always notify in auto mode; successful runs require
// "on" or run_finished. Waiting notifies auto and on.
want := 1
if mode == "off" || (mode == "auto" && status != "waiting") {
if mode == "off" || (mode == "auto" && status == "succeeded") {
want = 0
}
if len(ns) != want {
+3 -3
View File
@@ -42,10 +42,10 @@ JOIN pipeline_versions v ON v.pipeline_id=r.pipeline_id AND v.version=r.version
case "waiting":
title = "Run needs your decision"
body = "waiting for a human decision"
case "failed", "succeeded":
// A run's end notifies only for runs marked "on", unless the operator
case "failed", "interrupted", "succeeded":
// Successful runs notify only for runs marked "on", unless the operator
// opted into every run end via run_finished, read in this transaction.
if mode != "on" {
if status == "succeeded" && mode != "on" {
settings, err := readNotificationSettings(ctx, tx)
if err != nil {
return err
+31 -9
View File
@@ -39,25 +39,37 @@ type appNotifier struct {
}
type appNotificationSub struct {
queue chan protocol.Message
done chan struct{}
once sync.Once
ctx context.Context
requestID string
started time.Time
queue chan protocol.Message
done chan struct{}
once sync.Once
ended sync.Once
}
func newAppNotifier(store appNotificationStore) *appNotifier {
return &appNotifier{store: store, now: time.Now, subs: map[string]*appNotificationSub{}}
}
func (s *appNotificationSub) stop() { s.once.Do(func() { close(s.done) }) }
func (s *appNotificationSub) stop(reason string) {
s.once.Do(func() { close(s.done) })
s.ended.Do(func() {
log.Printf("notification subscription ended request_id=%q duration=%s reason=%s", s.requestID, time.Since(s.started), reason)
})
}
func (s *appNotificationSub) run(write func(protocol.Message) error) {
for {
select {
case <-s.done:
return
case <-s.ctx.Done():
s.stop("server stopping")
return
case msg := <-s.queue:
if write(msg) != nil {
s.stop()
s.stop("write error")
return
}
}
@@ -77,7 +89,7 @@ func (a *appNotifier) enqueueLocked(msg protocol.Message, exclude string) {
delete(a.subs, id)
default:
log.Printf("app notifications: dropping slow subscriber %s", id)
sub.stop()
sub.stop("write error")
delete(a.subs, id)
}
}
@@ -93,11 +105,15 @@ func (a *appNotifier) subscribe(ctx context.Context, clientID, requestID, after
return err
}
if old := a.subs[clientID]; old != nil {
old.stop()
old.stop("client closed")
}
sub := &appNotificationSub{
ctx: ctx, requestID: requestID, started: time.Now(),
queue: make(chan protocol.Message, appNotificationQueue), done: make(chan struct{}),
}
sub := &appNotificationSub{queue: make(chan protocol.Message, appNotificationQueue), done: make(chan struct{})}
sub.queue <- protocol.Message{Type: protocol.NotificationsSubscribed, ID: requestID, Notifications: active, IDs: cleared}
a.subs[clientID] = sub
log.Printf("notification subscription started request_id=%q cursor=%q", requestID, after)
go sub.run(write)
return nil
}
@@ -106,7 +122,11 @@ func (a *appNotifier) detach(clientID string) {
a.mu.Lock()
defer a.mu.Unlock()
if sub := a.subs[clientID]; sub != nil {
sub.stop()
reason := "client closed"
if sub.ctx.Err() != nil {
reason = "server stopping"
}
sub.stop(reason)
delete(a.subs, clientID)
}
}
@@ -290,6 +310,8 @@ func runNotificationKind(event string) string {
return protocol.NotificationRunWaiting
case "failed":
return protocol.NotificationRunFailed
case "interrupted":
return protocol.NotificationRunFailed
case "succeeded":
return protocol.NotificationRunSucceeded
}
+46
View File
@@ -1,10 +1,13 @@
package server
import (
"bytes"
"context"
"encoding/json"
"fmt"
"log"
"net/http/httptest"
"strings"
"testing"
"time"
@@ -17,6 +20,30 @@ import (
"git.a-wan.net/alan/pipelines/internal/summarise"
)
func TestAppNotificationSubscriptionLogsLifecycle(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
f := newAppNotificationFixture(t, ctx)
var output bytes.Buffer
previous := log.Writer()
log.SetOutput(&output)
t.Cleanup(func() { log.SetOutput(previous) })
phone := dialAckClient(t, ctx, f.url)
subscribeNotifications(t, ctx, phone, "cursor-1")
if !strings.Contains(output.String(), `notification subscription started request_id="sub" cursor="cursor-1"`) {
t.Fatalf("subscription start log = %q", output.String())
}
phone.CloseNow()
deadline := time.Now().Add(2 * time.Second)
for !strings.Contains(output.String(), `notification subscription ended request_id="sub"`) && time.Now().Before(deadline) {
time.Sleep(10 * time.Millisecond)
}
if !strings.Contains(output.String(), `notification subscription ended request_id="sub"`) || !strings.Contains(output.String(), "reason=client closed") {
t.Fatalf("subscription end log = %q", output.String())
}
}
// appNotificationFixture is a handler over a temp store with one pipeline,
// plus helpers to make a run end with a durable notification intent.
type appNotificationFixture struct {
@@ -50,6 +77,25 @@ func newAppNotificationFixture(t *testing.T, ctx context.Context) *appNotificati
return &appNotificationFixture{t: t, ctx: ctx, store: store, runner: handler.(*runHandler).runner, url: srv.URL, def: def}
}
func TestToolNotificationRecordsAppNotificationWhenNtfyDisabled(t *testing.T) {
ctx := context.Background()
store := newOperatorStore(t)
if _, err := store.UpdateNotificationSettings(ctx, map[string]any{protocol.NotifyNtfyEnabled: false}); err != nil {
t.Fatal(err)
}
hub := &chatHub{notes: newAppNotifier(store), settings: store}
if ok, diagnostic := hub.publishToolNotification(ctx, "session-1", "Build failed", "Please inspect the run"); !ok || diagnostic != "" {
t.Fatalf("tool notification result = %v, %q", ok, diagnostic)
}
active, _, err := store.ActiveAppNotifications(ctx, "", time.Now())
if err != nil || len(active) != 1 {
t.Fatalf("app notifications = %+v, %v", active, err)
}
if active[0].Kind != protocol.NotificationChatReply || active[0].Title != "Build failed" || active[0].Message != "Please inspect the run" {
t.Fatalf("wrong tool notification: %+v", active[0])
}
}
// failRun creates a "Notify me" run and fails it, which commits a durable run
// notification intent in the same transaction, then drains the outbox.
func (f *appNotificationFixture) failRun(name string) int64 {
+16 -7
View File
@@ -2,6 +2,8 @@ package server
import (
"context"
"crypto/sha256"
"encoding/hex"
"errors"
"io"
"log"
@@ -12,6 +14,7 @@ import (
"path/filepath"
"strings"
"git.a-wan.net/alan/pipelines/internal/pipeline"
"git.a-wan.net/alan/pipelines/internal/protocol"
)
@@ -128,14 +131,20 @@ type chatToolNotifier func(ctx context.Context, sessionID, title, message string
// ntfy destination (the one chat attention uses), honoring their ntfy switch.
// Tapping it opens the chat (pipelines://chat/<id>).
func (h *chatHub) publishToolNotification(ctx context.Context, sessionID, title, message string) (bool, string) {
if !chatAttentionConfigured() {
return false, "phone notifications (ntfy) are not configured on this Pipelines server"
}
if !chatNotificationSettings(ctx, h.settings).NtfyEnabled {
return false, "the operator has turned phone notifications off"
}
title = truncateUTF8(title, 256)
message = truncateUTF8(message, 2000)
click, views := chatAttentionLinks(sessionID)
if _, err := chatAttentionPublish(ctx, "system", truncateUTF8(title, 256), truncateUTF8(message, 2000), "", nil, click, views...); err != nil {
digest := sha256.Sum256([]byte(title + "\x00" + message))
if h.notes != nil {
h.notes.record(ctx, pipeline.AppNotificationRecord{
AppNotification: protocol.AppNotification{ID: "chat:" + sessionID + ":notify:" + hex.EncodeToString(digest[:8]), Kind: protocol.NotificationChatReply, Title: title, Message: message, Click: click, Priority: protocol.DefaultNotificationPriority, Tags: []string{}, Group: "chat:" + sessionID},
SessionID: sessionID,
})
}
if !chatAttentionConfigured() || !chatNotificationSettings(ctx, h.settings).NtfyEnabled {
return true, ""
}
if _, err := chatAttentionPublish(ctx, "system", title, message, "", nil, click, views...); err != nil {
log.Printf("chat tool notification session=%s: %v", sessionID, err)
return false, "the notification service refused it: " + err.Error()
}
+9 -5
View File
@@ -229,8 +229,8 @@ func runAttentionEvent(status string) string {
switch strings.TrimSpace(strings.ToLower(status)) {
case protocol.RunStatusWaiting:
return protocol.NotifyWaiting
case "failed":
return "failed"
case "failed", "interrupted":
return strings.TrimSpace(strings.ToLower(status))
}
return ""
}
@@ -375,9 +375,9 @@ func (r *runner) notifyRun(id int64, name, status string, sequence int, currentS
if event == "" {
return
}
// A run's end notifies only runs marked "on", unless the operator opted
// into every run end (run_finished); waiting notifies any non-off run.
if event != protocol.NotifyWaiting && r.notifyMode(id) != "on" {
// Failed or interrupted runs always notify; successful runs notify only when
// marked "on" or when the operator opted into every run end (run_finished).
if event == "succeeded" || (event != protocol.NotifyWaiting && event != "failed" && event != "interrupted") {
settings, err := r.store.NotificationSettings(r.ctx)
if err != nil || !settings.RunFinished {
return
@@ -392,6 +392,10 @@ func (r *runner) notifyRun(id int64, name, status string, sequence int, currentS
title = "Run failed"
summary = fmt.Sprintf("Run #%d · %s · run failed", id, name)
}
if event == "interrupted" {
title = "Run interrupted"
summary = fmt.Sprintf("Run #%d · %s · run interrupted", id, name)
}
if event == "succeeded" {
title = "Run succeeded"
summary = fmt.Sprintf("Run #%d · %s · run succeeded", id, name)
+20 -17
View File
@@ -105,8 +105,8 @@ func TestStageNotificationEventsAndArtifactAudit(t *testing.T) {
}
}
// Regress the terminal-path recipe from the authoring guide (research -> report
// there) on the bundled two-stage example's draft -> check.
// Regress the terminal-path recipe from the authoring guide on the bundled
// research -> report starter.
// A completion-alert request must not require native delivery or change run routing.
func TestTerminalNotificationRecipe(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
@@ -118,15 +118,14 @@ func TestTerminalNotificationRecipe(t *testing.T) {
defer store.Close()
var source string
for _, template := range examples.Catalog() {
if template.Key == "two-stages" {
if template.Key == "research" {
source = template.Source
}
}
if source == "" {
t.Fatal("two-stages template missing")
t.Fatal("research template missing")
}
source = strings.Replace(source, "# stage draft", "# stage draft\n```notify\non=failure\n```", 1)
source = strings.Replace(source, "# stage check", "# stage check\n```notify\non=success,failure\n```", 1)
source = strings.Replace(source, "# stage report", "# stage report\n```notify\non=success,failure\n```", 1)
if _, err = store.Submit(ctx, "research notification recipe", source); err != nil {
t.Fatal(err)
}
@@ -160,12 +159,12 @@ func TestTerminalNotificationRecipe(t *testing.T) {
name, stage, outcome, status string
executionError, deliveryError bool
}{
{"success", "check", "success", "succeeded", false, false},
{"draft blocked", "draft", "blocked", "failed", false, false},
{"draft execution error", "draft", "error", "failed", true, false},
{"check blocked", "check", "blocked", "failed", false, false},
{"check execution error", "check", "error", "failed", true, false},
{"delivery error preserves success", "check", "success", "succeeded", false, true},
{"success", "report", "success", "succeeded", false, false},
{"research blocked", "research", "blocked", "failed", false, false},
{"research execution error", "research", "error", "failed", true, false},
{"report blocked", "report", "blocked", "failed", false, false},
{"report execution error", "report", "error", "failed", true, false},
{"delivery error preserves success", "report", "success", "succeeded", false, true},
} {
t.Run(test.name, func(t *testing.T) {
deliveryFailure.Store(test.deliveryError)
@@ -278,7 +277,7 @@ func TestRunAttentionEventMapping(t *testing.T) {
{"running", ""},
{"succeeded", ""},
{"canceled", ""},
{"interrupted", ""},
{"interrupted", "interrupted"},
{"", ""},
} {
if got := runAttentionEvent(test.status); got != test.want {
@@ -320,7 +319,7 @@ func TestRunAttentionNotificationDelivery(t *testing.T) {
t.Fatal(err)
}
// A run that needs nobody publishes nothing.
for _, status := range []string{"queued", "running", "succeeded", "canceled", "interrupted"} {
for _, status := range []string{"queued", "running", "succeeded", "canceled"} {
r.notifyRun(7, "release", status, 1, "build", "")
}
select {
@@ -332,7 +331,7 @@ func TestRunAttentionNotificationDelivery(t *testing.T) {
r.notifyRun(7, "release", protocol.RunStatusWaiting, 1, "approve", "")
// A run that stays waiting is never republished, on a later call or a re-request.
r.notifyRun(7, "release", protocol.RunStatusWaiting, 1, "approve", "")
// An auto run's failure is silent: only runs marked "on" announce their end.
// An auto run's failure announces its end.
r.notifyRun(8, "release", "failed", 2, "deploy", "provider returned 500")
// A failed run marked "on" publishes once, with its diagnostic.
r.setNotifyMode(7, "on")
@@ -352,12 +351,16 @@ func TestRunAttentionNotificationDelivery(t *testing.T) {
t.Fatalf("notification leaked an authorization header: %q", first.authorization)
}
second := <-deliveries
if second.title != "Run failed" || !strings.Contains(second.message, "Run #7") || !strings.Contains(second.message, "release") || !strings.Contains(second.message, "deploy") || !strings.Contains(second.message, "provider returned 500") {
if second.title != "Run failed" || !strings.Contains(second.message, "Run #8") {
t.Fatalf("failed notification is not actionable: %+v", second)
}
if second.click != "pipelines://run/7" || second.actions != "view, Open in browser, https://pipelines.example.com/runs/7" {
if second.click != "pipelines://run/8" || second.actions != "view, Open in browser, https://pipelines.example.com/runs/8" {
t.Fatalf("failed notification click does not open the run: %q", second.click)
}
third := <-deliveries
if third.title != "Run failed" || !strings.Contains(third.message, "Run #7") {
t.Fatalf("marked failed notification is not actionable: %+v", third)
}
select {
case got := <-deliveries:
t.Fatalf("third notification delivered for two genuine events: %+v", got)
@@ -334,16 +334,15 @@ func TestRunNotificationAttentionModesAndRetryBound(t *testing.T) {
r.notifyRun(id, "test", status, sequence, "stage", "")
}
}
// auto waiting, on waiting and on failed; an auto run's failure is silent
// because run_finished defaults off.
if calls.Load() != 3 {
t.Fatalf("attention modes: %d calls, want 3", calls.Load())
// auto and on waiting, plus auto and on failed; off never notifies.
if calls.Load() != 4 {
t.Fatalf("attention modes: %d calls, want 4", calls.Load())
}
r.deliverRunNotifications(time.Now().Add(time.Minute))
r.deliverRunNotifications(time.Now().Add(2 * time.Minute))
r.deliverRunNotifications(time.Now().Add(3 * time.Minute))
if calls.Load() != 9 {
t.Fatalf("retry bound: %d calls, want 9", calls.Load())
if calls.Load() != 12 {
t.Fatalf("retry bound: %d calls, want 12", calls.Load())
}
for _, id := range []int64{1, 2, 3} {
got, err := s.RunNotifications(ctx, id)
+1 -1
View File
@@ -11,7 +11,7 @@ import (
)
func TestShowcaseGraphsRender(t *testing.T) {
for _, name := range []string{"one-stage", "two-stages", "feedback-loop", "human-decision"} {
for _, name := range []string{"research", "task"} {
t.Run(name, func(t *testing.T) {
source, err := os.ReadFile(filepath.Join("..", "..", "examples", name+".md"))
if err != nil {
+1 -1
View File
@@ -38,7 +38,7 @@ func TestTemplateSubmitNamesRetainsAndExplicitlyPublishesSelectedTemplate(t *tes
m.templateOpen, m.keys.templates = true, true
m.defaultModel = "fixture/model"
for i, item := range m.templates {
if item.Key == "one-stage" {
if item.Key == "research" {
m.templateIndex = i
}
}
+1 -1
View File
@@ -92,7 +92,7 @@ func TestTemplateGraphPreviewFocusNavigationAndSizes(t *testing.T) {
t.Fatal(err)
}
view := ansi.Strip(m.View())
if !strings.Contains(view, parsed.Stages[0].Key) {
if size.w >= 80 && !strings.Contains(strings.ToLower(view), strings.ToLower(parsed.Stages[0].Key)) {
t.Fatal("focused graph does not match selected template", size, item.Key, view)
}
oldIndex, oldTop := m.templateIndex, m.templateTop
+3 -3
View File
@@ -21,7 +21,7 @@ func TestUIUXReviewSnapshots(t *testing.T) {
if err := os.MkdirAll(directory, 0700); err != nil {
t.Fatal(err)
}
source, err := os.ReadFile("../../examples/human-decision.md")
source, err := os.ReadFile("../../examples/task.md")
if err != nil {
t.Fatal(err)
}
@@ -36,7 +36,7 @@ func TestUIUXReviewSnapshots(t *testing.T) {
m.loaded = true
m.status = "127.0.0.1:8080"
m.notificationEndpoints = []protocol.NotificationEndpoint{{Destination: "system", ServerURL: "http://100.85.25.33:8090", Topic: "pipelines"}}
m.pipelines = []protocol.PipelineSummary{{ID: 8, Name: "Example 4: human decision", Version: 1, Stages: 3, CreatedAt: "2026-10-08T20:00:00Z", UpdatedAt: "2026-10-08T20:00:00Z"}}
m.pipelines = []protocol.PipelineSummary{{ID: 8, Name: "Implement, review and land", Version: 1, Stages: 4, CreatedAt: "2026-10-08T20:00:00Z", UpdatedAt: "2026-10-08T20:00:00Z"}}
save := func(name string) {
t.Helper()
view := ansi.Strip(m.View())
@@ -66,7 +66,7 @@ func TestUIUXReviewSnapshots(t *testing.T) {
save("review-stage")
m.runOpen = true
m.keys.runs = true
m.runDetail = &protocol.RunDetail{RunSummary: protocol.RunSummary{ID: 1, Name: "Example 4: human decision", PipelineID: 8, Version: 1, Status: "succeeded", CreatedAt: "2026-10-08T20:00:00Z", FinishedAt: "2026-10-08T20:01:00Z"}, Graph: graph, Steps: []protocol.RunStep{{Sequence: 1, Stage: "plan", Status: "completed", Outcome: "success", Target: "decide"}, {Sequence: 2, Stage: "decide", Status: "completed", Outcome: "approve", Target: "act"}, {Sequence: 3, Stage: "act", Status: "completed", Outcome: "success", Target: protocol.SuccessEnd, Output: map[string]any{"summary": "Fixture review report", "findings": "Fixture findings"}}}}
m.runDetail = &protocol.RunDetail{RunSummary: protocol.RunSummary{ID: 1, Name: "Implement, review and land", PipelineID: 8, Version: 1, Status: "succeeded", CreatedAt: "2026-10-08T20:00:00Z", FinishedAt: "2026-10-08T20:01:00Z"}, Graph: graph, Steps: []protocol.RunStep{{Sequence: 1, Stage: "Code", Status: "completed", Outcome: "success", Target: "Review"}, {Sequence: 2, Stage: "Review", Status: "completed", Outcome: "success", Target: "UIReview"}, {Sequence: 3, Stage: "UIReview", Status: "completed", Outcome: "approved", Target: "Land"}, {Sequence: 4, Stage: "Land", Status: "completed", Outcome: "success", Target: protocol.SuccessEnd, Output: map[string]any{"summary": "Fixture review report", "findings": "Fixture findings"}}}}
m.runStepIndex = 3
save("run")
}