From eabe5d64dd971e692174d000b72adfc37a7007b2 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 21 Oct 2026 13:16:14 +0100 Subject: [PATCH 1/4] docs(app): track five parallel Luna runs and integration queue --- app/WORK.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/app/WORK.md b/app/WORK.md index f59d1be6..fdad4d15 100644 --- a/app/WORK.md +++ b/app/WORK.md @@ -6,11 +6,12 @@ All work under app/. Existing applications remain running and unchanged. ## First wave (independent worktrees, Task v6, Luna for every stage) | Item | Scope | Source | Verification | Landing | Preview | | --- | --- | --- | --- | --- | --- | -| F0 | Scaffold and gateway contract | ready | pending | pending | not served | -| F1 | Socket transport, endpoint rules, reconnect | queued | pending | pending | — | -| F2 | Adaptive shell and standard platform controls | queued | pending | pending | pending | -| F3 | Run models, live event fold, actions | queued | pending | pending | — | -| F4 | Chat models, history/live fold, request facade | queued | pending | pending | — | +| F0 | Scaffold and gateway contract | 0e0ef54 | analyze + 1 scaffold test pass | main | not served | +| F1 | Socket transport, endpoint rules, reconnect | run 24 / flutter/f1-transport | running | pending | — | +| F2 | Adaptive shell and standard platform controls | run 25 / flutter/f2-shell | running | pending | pending | +| F3 | Run models, live event fold, actions | run 26 / flutter/f3-runs | running | pending | — | +| F4 | Chat models, history/live fold, request facade | run 27 / flutter/f4-chat | running | pending | — | +| F5 | Isolated authenticated web preview tooling | run 28 / flutter/f5-preview | running | pending | pending | ## Next ready work - P1 pipelines list/detail/source/version; P2 graph and stage/visit selection. @@ -21,10 +22,17 @@ All work under app/. Existing applications remain running and unchanged. - X1 search; N1 settings/persistence/notifications; I1 routes/deep links and integration. F1 + F2 unlock live preview and feature screens. F3/F4 unlock runs/chat UI. +F5 provides a separate authenticated preview URL, without production changes. Parallel tasks own separate feature subdirectories and tests. Manager owns main, shell registration, pubspec, this queue and integration. Small shared-file edits are resolved at landing, not used to serialize independent features. +Each run pins Task v6 with a whole-run `openai/gpt-6-luna` override (all four +stages), app-only write scope, its own worktree under tmp/flutter-fN, and an +individual background `pipelines wait`. No workflow definitions were modified. +The CLI reports a client/server build mismatch; admission succeeded and the +server echoed the expected model/scope. No shared service was rebuilt/restarted. + ## Completion loop Use pipelines wait for every started run. Inspect failure evidence before fixing, resuming or retrying; preserve partial work. On success inspect actual diff and From 184ce78b65a5321010d27e3c074f7308aaf25131 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 21 Oct 2026 13:16:20 +0100 Subject: [PATCH 2/4] fix(notify): resolve web links for transactional outbox deliveries --- docs/notes/notification-web-links.md | 15 ++++-- internal/pipeline/run_notifications.go | 4 +- internal/server/notify.go | 6 +++ .../server/run_notification_outbox_test.go | 53 +++++++++++++++++++ 4 files changed, 72 insertions(+), 6 deletions(-) diff --git a/docs/notes/notification-web-links.md b/docs/notes/notification-web-links.md index 8832be1f..6e168d8f 100644 --- a/docs/notes/notification-web-links.md +++ b/docs/notes/notification-web-links.md @@ -18,7 +18,14 @@ service-environment retention on both renderers. The isolated real proxy test checks unauthenticated gating, wrong-password rejection and return to the exact run after login. No production notification was sent to test this fix. -Code is not deployed/configured on the live server: the operator's phone-facing -web URL is still needed, and a backend update must wait for safe deployment. -Dummy run #22 completed with its old `pipelines://run/22` notification acknowledged -by ntfy; that verifies publishing, not reception or correct web navigation. +The operator supplied `https://alans-macbook-pro.tail6bf4dc.ts.net:8443/pipelines`; +the configured origin excludes the pipeline-list route. Deployment was authorized. +The first live check (#23) exposed a missing transactional-outbox path: the store +had already enqueued a legacy link before the server callback, so an insert-only +callback did not change it. Dispatch now resolves that placeholder to the +configured web link (also after restart), and the completed receipt saves the +actual target used. Added real FinishRun/outbox and failed-publication/reopen +regressions. Previously sent alerts are not modified or resent. + +Dummy runs #22 and #23 completed with their old Android-link notifications +acknowledged by ntfy. Those verify publishing, not correct web navigation. diff --git a/internal/pipeline/run_notifications.go b/internal/pipeline/run_notifications.go index 086395ea..fc3cb9d4 100644 --- a/internal/pipeline/run_notifications.go +++ b/internal/pipeline/run_notifications.go @@ -167,8 +167,8 @@ func (s *Store) FinishRunNotification(ctx context.Context, n RunNotification, no status = "failed" } } - _, err := s.db.ExecContext(ctx, `UPDATE run_notifications SET status=?,diagnostic=?,message_id=?,next_attempt=? -WHERE run_id=? AND sequence=? AND event=? AND channel=? AND status='sending' AND attempts=?`, status, diagnostic, messageID, now+int64(n.Attempts*5), n.RunID, n.Sequence, n.Event, n.Channel, n.Attempts) + _, err := s.db.ExecContext(ctx, `UPDATE run_notifications SET status=?,diagnostic=?,message_id=?,next_attempt=?,click=? +WHERE run_id=? AND sequence=? AND event=? AND channel=? AND status='sending' AND attempts=?`, status, diagnostic, messageID, now+int64(n.Attempts*5), n.Click, n.RunID, n.Sequence, n.Event, n.Channel, n.Attempts) return err } diff --git a/internal/server/notify.go b/internal/server/notify.go index 42233cee..662f3dd6 100644 --- a/internal/server/notify.go +++ b/internal/server/notify.go @@ -386,6 +386,12 @@ func (r *runner) deliverRunNotificationBatch(now time.Time, limit int) { if n == nil { return } + // State transitions enqueue their intent inside the store transaction, + // before notifyRun can supply a server-configured URL. Resolve that + // legacy placeholder here too, including pending intents after restart. + if os.Getenv("PIPELINES_WEB_PUBLIC_URL") != "" && n.Click == fmt.Sprintf("pipelines://run/%d", n.RunID) { + n.Click = runAttentionClick(n.RunID) + } ctx, cancel := context.WithTimeout(r.ctx, 30*time.Second) result, publishErr := stage.PublishNtfy(ctx, n.Channel, n.Title, n.Body, "", nil, n.Click) cancel() diff --git a/internal/server/run_notification_outbox_test.go b/internal/server/run_notification_outbox_test.go index d4f1fa1b..95840e2c 100644 --- a/internal/server/run_notification_outbox_test.go +++ b/internal/server/run_notification_outbox_test.go @@ -3,6 +3,7 @@ package server import ( "context" "encoding/json" + "fmt" "net/http" "net/http/httptest" "path/filepath" @@ -18,6 +19,7 @@ import ( ) func TestRunNotificationPublisherFailureRetriesAfterReopen(t *testing.T) { + t.Setenv("PIPELINES_WEB_PUBLIC_URL", "https://pipelines.example.com") ctx := context.Background() path := filepath.Join(t.TempDir(), "retry.db") s, err := pipeline.Open(path) @@ -26,6 +28,9 @@ func TestRunNotificationPublisherFailureRetriesAfterReopen(t *testing.T) { } var calls atomic.Int32 server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if got := r.Header.Get("Click"); got != "https://pipelines.example.com/runs/7" { + t.Errorf("wrong web retry link: %q", got) + } if calls.Add(1) == 1 { http.Error(w, "transient", http.StatusServiceUnavailable) return @@ -37,6 +42,10 @@ func TestRunNotificationPublisherFailureRetriesAfterReopen(t *testing.T) { t.Setenv("PIPELINES_NTFY_TOKEN", "") t.Setenv("PIPELINES_NTFY_TOKEN_FILE", "") r := &runner{ctx: ctx, store: s} + // Emulate a durable transition intent saved before the runner callback. + if err := s.EnqueueRunNotification(ctx, pipeline.RunNotification{RunID: 7, Sequence: 1, Event: "failed", Channel: "system", Title: "Run failed", Body: "Run 7", Click: "pipelines://run/7"}); err != nil { + t.Fatal(err) + } r.notifyRun(7, "test", "failed", 1, "stage", "") got, err := s.RunNotifications(ctx, 7) if err != nil || len(got) != 1 || got[0].Status != "pending" || got[0].Attempts != 1 || got[0].Diagnostic == "" { @@ -59,6 +68,50 @@ func TestRunNotificationPublisherFailureRetriesAfterReopen(t *testing.T) { } } +func TestTransactionalSuccessNotificationUsesWebLink(t *testing.T) { + ctx := context.Background() + s, err := pipeline.Open(filepath.Join(t.TempDir(), "web-success.db")) + if err != nil { + t.Fatal(err) + } + defer s.Close() + if _, err := s.Submit(ctx, "test", pipeline.Template([]string{"one"}, true)); err != nil { + t.Fatal(err) + } + items, _ := s.List(ctx) + d, err := s.Get(ctx, items[0].ID, 1) + if err != nil { + t.Fatal(err) + } + id, _, err := s.CreateRunTitled(ctx, d, "web-success", t.TempDir(), false, nil, nil, pipeline.RunOverrides{NotifyMode: "on"}, summarise.Title{}) + if err != nil { + t.Fatal(err) + } + if err := s.FinishRun(ctx, id, "succeeded", "success", "", nil); err != nil { + t.Fatal(err) + } + var calls atomic.Int32 + endpoint := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + calls.Add(1) + if got, want := req.Header.Get("Click"), "https://pipelines.example.com/runs/"+fmt.Sprint(id); got != want { + t.Errorf("click = %q, want %q", got, want) + } + _ = json.NewEncoder(w).Encode(map[string]string{"id": "web-success", "event": "message"}) + })) + defer endpoint.Close() + t.Setenv("PIPELINES_WEB_PUBLIC_URL", "https://pipelines.example.com") + t.Setenv("PIPELINES_NTFY_URL", endpoint.URL+"/fake") + t.Setenv("PIPELINES_NTFY_TOKEN", "") + t.Setenv("PIPELINES_NTFY_TOKEN_FILE", "") + r := &runner{ctx: ctx, store: s} + r.notifyRun(id, "test", "succeeded", 0, "", "") + r.deliverRunNotifications(time.Now()) + got, err := s.RunNotifications(ctx, id) + if err != nil || len(got) != 1 || got[0].Status != "sent" || calls.Load() != 1 { + t.Fatalf("notification: %+v calls=%d err=%v", got, calls.Load(), err) + } +} + func TestFinishRunPersistenceFailureDoesNotAnnounceSuccess(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() From 264f64c0bba29038b38274cbe9d3b6190f1f6554 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 21 Oct 2026 13:18:33 +0100 Subject: [PATCH 3/4] docs(app): record corrected app-only admissions and preserved partial work --- app/WORK.md | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/app/WORK.md b/app/WORK.md index fdad4d15..300c7588 100644 --- a/app/WORK.md +++ b/app/WORK.md @@ -7,11 +7,11 @@ All work under app/. Existing applications remain running and unchanged. | Item | Scope | Source | Verification | Landing | Preview | | --- | --- | --- | --- | --- | --- | | F0 | Scaffold and gateway contract | 0e0ef54 | analyze + 1 scaffold test pass | main | not served | -| F1 | Socket transport, endpoint rules, reconnect | run 24 / flutter/f1-transport | running | pending | — | -| F2 | Adaptive shell and standard platform controls | run 25 / flutter/f2-shell | running | pending | pending | -| F3 | Run models, live event fold, actions | run 26 / flutter/f3-runs | running | pending | — | -| F4 | Chat models, history/live fold, request facade | run 27 / flutter/f4-chat | running | pending | — | -| F5 | Isolated authenticated web preview tooling | run 28 / flutter/f5-preview | running | pending | pending | +| F1 | Socket transport, endpoint rules, reconnect | run 29 / flutter/f1-transport | running | pending | — | +| F2 | Adaptive shell and standard platform controls | run 31 / flutter/f2-shell | running | pending | pending | +| F3 | Run models, live event fold, actions | run 32 / flutter/f3-runs | running | pending | — | +| F4 | Chat models, history/live fold, request facade | run 33 / flutter/f4-chat | running | pending | — | +| F5 | Isolated authenticated web preview tooling | run 30 / flutter/f5-preview | running | pending | pending | ## Next ready work - P1 pipelines list/detail/source/version; P2 graph and stage/visit selection. @@ -28,11 +28,21 @@ shell registration, pubspec, this queue and integration. Small shared-file edits are resolved at landing, not used to serialize independent features. Each run pins Task v6 with a whole-run `openai/gpt-6-luna` override (all four -stages), app-only write scope, its own worktree under tmp/flutter-fN, and an +stages), app/ as workspace, its own worktree under tmp/flutter-fN, and an individual background `pipelines wait`. No workflow definitions were modified. The CLI reports a client/server build mismatch; admission succeeded and the server echoed the expected model/scope. No shared service was rebuilt/restarted. +### Corrected admission scope +Run 24 failed before edits: `--write-paths app` grants an exact path, not a +directory subtree. Runs 25–28 were stopped once the common admission mistake was +confirmed, and their agents settled. Partial shell/run/chat files remain in the +same worktrees. New runs 29/31/32/33/30 continue those retained files with app/ +itself as workspace and default workspace edit scope. Retry preserves the old +workspace/write scope, so could not correct this admission mistake. No policy +override, server edit or shell-write bypass was used by the manager. +Allowed pipeline models: Luna or DeepSeek V4.1 Flash; current runs use Luna. + ## Completion loop Use pipelines wait for every started run. Inspect failure evidence before fixing, resuming or retrying; preserve partial work. On success inspect actual diff and From 718442d73d28770fda65f9146a5948c1be8e2494 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 21 Oct 2026 13:22:40 +0100 Subject: [PATCH 4/4] fix(app): include feature data source in version control --- app/.gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/.gitignore b/app/.gitignore index 3820a95c..9f91cbac 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -43,3 +43,8 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release + +# The repository ignores runtime data/ directories. Feature repository source +# is code, not runtime data, and must be included in fresh checkouts. +!/lib/**/data/ +!/lib/**/data/**