Merge main into flutter/f4-chat
This commit is contained in:
+4
-2
@@ -44,5 +44,7 @@ app.*.map.json
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
|
||||
# Chat's source adapter lives in a directory commonly ignored as generated data.
|
||||
!lib/features/chat/data/
|
||||
# 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/**
|
||||
|
||||
+23
-5
@@ -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 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.
|
||||
@@ -21,10 +22,27 @@ 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/ 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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user