oficina / equipo Public

Merge thin-v1-ux1-data (d9080b3): data for the inner screens

Step activity lines, source message, creator name, duplicate_of and
fold, coordinator activity, project facts and repo heads, notebook
entries tagged with a project, fixtures and contract tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev fd6f38281797c63c6511666c9521984c86be971f parent f993f82parent d9080b3
43 files changed, +1,001 −61
  • .rastrillo/budgets.txt +1 −1
  • internal/equipo/chat/http.go +15 −0
  • internal/equipo/chat/inner.go +323 −0
  • internal/equipo/chat/projects.go +5 −2
  • internal/equipo/chat/runner.go +2 −0
  • internal/equipo/chat/store.go +4 −0
  • internal/equipo/chat/stream.go +1 −1
  • internal/equipo/chat/tasks.go +21 −4
  • internal/equipo/migrations/0048_thin_ux1.sql +2 −0
  • internal/equipo/migrations/schema.sql +2 −2
  • internal/fakeclaude/fake.go +19 −1
  • internal/headless/engineering_test.go +22 −1
  • internal/plan3test/person_api_contract_test.go +1 −1
  • internal/runner/thin/bridge.go +26 −9
  • internal/runner/thin/claude.go +1 −1
  • internal/runner/thin/desk_test.go +36 −5
  • internal/runner/thin/engineer.go +77 −9
  • internal/runner/thin/index.go +46 −5
  • internal/runner/thin/index_facts_test.go +75 −0
  • internal/runner/thin/judge.go +1 −1
  • internal/runner/thin/link.go +31 −0
  • internal/runner/thin/mcp.go +1 −1
  • internal/runner/thin/run.go +1 −1
  • internal/thintest/client.go +15 −2
  • internal/thintest/inner_contract_test.go +246 −0
  • internal/wire/tasks_test.go +8 −0
  • internal/wire/wire_test.go +1 −1
  • internal/wire/wiretest/fixtures.go +3 −1
  • internal/wire/wiretest/testdata/api/duplicate-request.json +1 −0
  • internal/wire/wiretest/testdata/api/event-project.json +1 −1
  • internal/wire/wiretest/testdata/api/event-step-activity.json +1 −0
  • internal/wire/wiretest/testdata/api/event-step.json +1 −1
  • internal/wire/wiretest/testdata/api/event-task.json +1 −1
  • internal/wire/wiretest/testdata/api/needs-you.json +1 −1
  • internal/wire/wiretest/testdata/api/project.json +1 −1
  • internal/wire/wiretest/testdata/api/projects.json +1 −1
  • internal/wire/wiretest/testdata/api/snapshot.json +1 −1
  • internal/wire/wiretest/testdata/api/task-merged.json +1 −1
  • internal/wire/wiretest/testdata/api/task-ready.json +1 −1
  • internal/wire/wiretest/testdata/api/task.json +1 −1
  • internal/wire/wiretest/testdata/api/tasks.json +1 −1
  • internal/wire/wiretest/testdata/frames/hello.json +1 −1
  • internal/wire/wiretest/testdata/frames/step_activity.json +1 −0
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index 0aea824a..4c0096ed 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -36,7 +36,7 @@ perf GET /releases/* skip Verified runner release file downloads, not browser GE
time internal/runner/containment 15s Plan 3 loaded CI measured 10.817s; niced serial reruns measured 5.773s and 5.750s. The added coordinator mount check has no repeated launches to remove; 15s leaves 38 percent headroom for namespace, process-exit and recovery assertions.
time internal/tryequipo 30s Release starter-set controller K3 records CI runs of 10.8s and 13.1s; 30s retains the guide integration checks with headroom on the shared runner.
size internal/runner/thin 8500 - Thin v1 slice 4c adds the merge step (mergestep.go, about 190 lines) and the rebase round beside the slice 4b ask fixes. Thin v1 slice 3 adds Engineering steps beside the coordinator: the durable step state and engine (step.go) and the executor that checks out the task tree, runs the CLI in the implement containment, commits and pushes (engineer.go), about 800 lines sharing the coordinator's launch, tool socket and account selection. Measured 5686 source lines. Splitting would export the launch internals; revisit at the slice 7 sweep. Slice 4 adds checks and review on a candidate (judge.go) and the merge watch (merge.go), about 800 lines, sharing the Engineer launch path; measured 6808, 7035 after review round 1 (branch head watch, deadlines, streamed outputs). Slice 4b keeps Engineering and Review sessions and answers the creator's questions from them (ask.go: kept-session and ask state, read-only git tools, the answer stream), about 700 lines on the same launch path.
-time internal/thintest 30s Thin v1 contract tests: a real instance and a scripted runner per test, fixtures replayed against every request, frame and event. Slice 3 adds the task, step-sync and grant contracts; CI measured 14.805s. 30s keeps room for the slice 4 review contracts.
+time internal/thintest 40s Thin v1 contract tests: a real instance and a scripted runner per test, fixtures replayed against every request, frame and event. Slice 3 adds the task, step-sync and grant contracts; CI measured 14.805s. 30s keeps room for the slice 4 review contracts. UX1 adds step activity, task source and duplicates, coordinator merging and project facts (four contracts, about 6s); the package measured 34s locally under load, so 40s.
time internal/runner/thin 45s Thin v1 slice 4 review: real git repositories for the merge and squash checks, a stalled fetch, and a 16 MiB candidate streamed through the review diff and the checks pack (about 5s). Measured 17.8s locally under load. Slice 4b review adds a 16 MiB git output bound, an injected index-pack failure and stall (3s deadline) and held-answer tests; measured 30.3s locally under load. 45s keeps 33 percent headroom.
time internal/headless 240s Thin v1 headless suite: real instance, runner and bubblewrap per scenario (spec 7, under two minutes). Slice 4 adds the review and checks scenarios (4_review with its fix rounds, branch move and merge; 4_checks_honest); loaded CI measured 170s on 2026-11-07. Slice 4b adds 4b_ask (about 12s); loaded CI measured 182.9s. 240s keeps 30 percent headroom.
perf GET /api/v1/turns/{id} skip Thin v1 person API: bearer-only JSON for devices, not a browser screen.
diff --git a/internal/equipo/chat/http.go b/internal/equipo/chat/http.go
index 108d06f2..d649a2d2 100644
--- a/internal/equipo/chat/http.go
+++ b/internal/equipo/chat/http.go
@@ -75,6 +75,7 @@ func (h *HTTP) Mount(r chi.Router) {
r.Get("/tasks/{id}", h.thinOr("GET /tasks/{id}", thinTask, h.bearer(h.task)))
r.Post("/tasks/{id}/cancel", h.thinOr("POST /tasks/{id}/cancel", thinTask, h.bearer(h.cancelTask)))
r.Post("/tasks/{id}/retry", h.bearer(h.retryTask))
+ r.Post("/tasks/{id}/duplicate", h.bearer(h.markDuplicate))
r.Post("/tasks/{id}/thread", h.bearer(h.postThread))
r.Get("/steps/{id}/log", h.bearer(h.stepLog))
r.Post("/tasks/{id}/questions", h.bearer(h.ask))
@@ -449,6 +450,20 @@ func (h *HTTP) retryTask(w http.ResponseWriter, r *http.Request, p personapi.Per
writeJSON(w, http.StatusAccepted, wire.TaskAccepted{Attempt: attempt})
}
+func (h *HTTP) markDuplicate(w http.ResponseWriter, r *http.Request, p personapi.PersonPrincipal) {
+ var in wire.MarkDuplicate
+ if err := readJSON(r, &in); err != nil {
+ h.fail(w, r, err)
+ return
+ }
+ out, err := h.Store.MarkDuplicate(r.Context(), p.Address, chi.URLParam(r, "id"), in)
+ if err != nil {
+ h.fail(w, r, err)
+ return
+ }
+ writeJSON(w, 200, out)
+}
+
func (h *HTTP) postThread(w http.ResponseWriter, r *http.Request, p personapi.PersonPrincipal) {
var in wire.PostThread
if err := readJSON(r, &in); err != nil {
diff --git a/internal/equipo/chat/inner.go b/internal/equipo/chat/inner.go
new file mode 100644
index 00000000..77876e0d
--- /dev/null
+++ b/internal/equipo/chat/inner.go
@@ -0,0 +1,323 @@
+package chat
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "slices"
+ "strings"
+ "unicode"
+ "unicode/utf8"
+
+ "gorm.io/gorm"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// What the inner screens show beyond the task itself: a step's newest
+// activity lines, the task's people and source, a possible duplicate,
+// the coordinator at work on it, and what Equipo knows of a project.
+
+// DisplayName is a member's name until people have profiles: the
+// address's local part up to the first ".", "_", "-" or "+", capitalised;
+// initials is its first letter.
+func DisplayName(address string) (name, initials string) {
+ local, _, _ := strings.Cut(address, "@")
+ if i := strings.IndexAny(local, "._-+"); i > 0 {
+ local = local[:i]
+ }
+ r, n := utf8.DecodeRuneInString(local)
+ if n == 0 || r == utf8.RuneError {
+ return address, ""
+ }
+ first := string(unicode.ToUpper(r))
+ return first + local[n:], first
+}
+
+func personRef(address string) wire.PersonRef {
+ name, initials := DisplayName(address)
+ return wire.PersonRef{Address: address, Name: name, Initials: initials}
+}
+
+func decodeActivity(raw string) []wire.ActivityLine {
+ out := []wire.ActivityLine{}
+ if raw != "" {
+ _ = json.Unmarshal([]byte(raw), &out)
+ }
+ return out
+}
+
+var activityKinds = []string{wire.ActivityRead, wire.ActivitySearch, wire.ActivityEdit, wire.ActivityRun, wire.ActivityOther}
+
+// activitySubject is a line's subject made safe to show: one line, no
+// control characters, the workspace prefix gone, bounded.
+func activitySubject(s string) string {
+ if !utf8.ValidString(s) {
+ return ""
+ }
+ s, _, _ = strings.Cut(strings.TrimSpace(s), "\n")
+ s = strings.TrimPrefix(strings.TrimSpace(s), "/workspace/")
+ s = strings.Map(func(r rune) rune {
+ if unicode.IsControl(r) {
+ return -1
+ }
+ return r
+ }, s)
+ if len(s) > wire.MaxActivitySubject {
+ s = s[:wire.MaxActivitySubject]
+ for !utf8.ValidString(s) {
+ s = s[:len(s)-1]
+ }
+ }
+ return strings.TrimSpace(s)
+}
+
+// stepActivity keeps a running step's newest activity line and tells
+// every member. Only the step person's primary runner, for the current
+// attempt of a step that has not ended; anything else is dropped (the
+// frame is not durable, so nothing waits on it).
+func (t *txn) stepActivity(l Lease, v *wire.StepActivityReport) error {
+ var s stepRecord
+ if err := t.db.Where("id = ? AND task_id = ?", v.StepID, v.TaskID).First(&s).Error; errors.Is(err, gorm.ErrRecordNotFound) {
+ return nil
+ } else if err != nil {
+ return err
+ }
+ if s.Person != l.Runner.Person || v.Attempt != s.Attempt || wire.StepTerminal(s.State) {
+ return nil
+ }
+ primary, err := t.s.authority.PrimaryRunner(t.db, s.Person)
+ if err != nil {
+ return err
+ }
+ if primary != l.Runner.RunnerID {
+ return nil
+ }
+ kind := v.Kind
+ if !slices.Contains(activityKinds, kind) {
+ kind = wire.ActivityOther
+ }
+ lines := append(decodeActivity(s.Activity), wire.ActivityLine{Kind: kind, Subject: activitySubject(v.Subject), At: t.now()})
+ if len(lines) > wire.MaxStepActivity {
+ lines = lines[len(lines)-wire.MaxStepActivity:]
+ }
+ raw, _ := json.Marshal(lines)
+ if err := t.db.Model(&stepRecord{}).Where("id = ?", s.ID).Update("activity", string(raw)).Error; err != nil {
+ return err
+ }
+ members, err := t.members()
+ if err != nil {
+ return err
+ }
+ data := wire.StepActivity{TaskID: s.TaskID, StepID: s.ID, Attempt: s.Attempt, Activity: lines}
+ for _, m := range members {
+ if err := t.event(m, wire.EventActivity, wire.ResourceStep, s.ID, 0, "", "", s.Attempt, data); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+// taskExtras fills what the screens show around a task: the creator's
+// name, the message it was noted from, a possible duplicate and the
+// coordinator at work on it.
+func (t *txn) taskExtras(v *wire.Task, k taskRecord, steps []stepRecord) error {
+ v.CreatorName, _ = DisplayName(k.Creator)
+ if k.TurnID != "" {
+ var m messageRecord
+ err := t.db.Where("turn_id = ? AND person = ? AND role = ?", k.TurnID, k.Creator, wire.RolePerson).Order("seq").First(&m).Error
+ if err == nil {
+ at := m.CreatedAt
+ v.SourceMessageID, v.SourceAt = m.ID, &at
+ } else if !errors.Is(err, gorm.ErrRecordNotFound) {
+ return err
+ }
+ }
+ if k.DuplicateOf != "" {
+ var d taskRecord
+ err := t.db.Select("id", "title", "stage").Where("id = ?", k.DuplicateOf).First(&d).Error
+ if err == nil {
+ v.DuplicateOf = &wire.TaskRef{ID: d.ID, Title: d.Title, Stage: d.Stage}
+ } else if !errors.Is(err, gorm.ErrRecordNotFound) {
+ return err
+ }
+ }
+ switch k.Stage {
+ case wire.StageMerging:
+ since := k.UpdatedAt
+ for i := len(steps) - 1; i >= 0; i-- {
+ if steps[i].Specialist == wire.SpecialistMerge {
+ if steps[i].StartedAt != nil {
+ since = *steps[i].StartedAt
+ }
+ break
+ }
+ }
+ v.Coordinator = &wire.TaskActivity{Kind: wire.CoordinatorMerging, Since: since}
+ case wire.StageNoted, wire.StageInvestigated:
+ if k.TurnID == "" {
+ break
+ }
+ var r turnRecord
+ err := t.db.Select("id", "state", "created_at").Where("id = ?", k.TurnID).First(&r).Error
+ if err == nil && !wire.Terminal(r.State) {
+ v.Coordinator = &wire.TaskActivity{Kind: wire.CoordinatorLooking, Since: r.CreatedAt}
+ } else if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
+ return err
+ }
+ }
+ return nil
+}
+
+// MarkDuplicate folds a task into another open task of the same project:
+// only its creator; the task is cancelled as Cancel does, and its title
+// and brief go on the other task's thread as a report.
+func (s *Store) MarkDuplicate(ctx context.Context, person, id string, in wire.MarkDuplicate) (out wire.Task, err error) {
+ err = s.tx(ctx, func(t *txn) error {
+ if err := s.authority.CurrentPerson(ctx, t.db); err != nil {
+ return err
+ }
+ k, err := t.loadTask(id)
+ if err != nil {
+ return err
+ }
+ if k.Creator != person {
+ return ErrForbidden
+ }
+ if wire.FinalStage(k.Stage) || k.CancelRequested {
+ return ErrTaskEnded
+ }
+ of := strings.TrimSpace(in.Of)
+ if of == "" || of == k.ID {
+ return ErrInvalid
+ }
+ target, err := t.loadTask(of)
+ if err != nil {
+ return err
+ }
+ if target.ProjectID != k.ProjectID || wire.FinalStage(target.Stage) || target.CancelRequested {
+ return ErrInvalid
+ }
+ if err := t.db.Model(&taskRecord{}).Where("id = ?", k.ID).Update("duplicate_of", target.ID).Error; err != nil {
+ return err
+ }
+ if _, err := t.cancelTask(person, k.ID); err != nil {
+ return err
+ }
+ var n int64
+ if err := t.db.Model(&entryRecord{}).Where("task_id = ? AND kind <> ?", target.ID, entryFinding).Count(&n).Error; err != nil {
+ return err
+ }
+ if n < wire.MaxThread {
+ text := k.Title
+ if k.Brief != "" {
+ text += "\n\n" + k.Brief
+ }
+ text = clip(text, wire.MaxThreadText)
+ e := entryRecord{ID: newID("e_"), TaskID: target.ID, IdempotencyKey: "duplicate:" + k.ID, Kind: entryReport, Author: person, Text: text, CreatedAt: t.now()}
+ if err := t.db.Create(&e).Error; err != nil {
+ return err
+ }
+ if err := t.saveTask(&target); err != nil {
+ return err
+ }
+ }
+ if k, err = t.loadTask(k.ID); err != nil {
+ return err
+ }
+ out, err = t.taskView(k)
+ return err
+ })
+ return out, err
+}
+
+func clip(s string, n int) string {
+ if len(s) <= n {
+ return s
+ }
+ s = s[:n]
+ for !utf8.ValidString(s) {
+ s = s[:len(s)-1]
+ }
+ return s
+}
+
+// stackNames are the catalog's hints as people name them.
+var stackNames = map[string]string{"go": "Go", "swift": "Swift", "swiftui": "SwiftUI", "javascript": "JavaScript", "react": "React", "vue": "Vue", "svelte": "Svelte", "next": "Next.js", "vite": "Vite", "rust": "Rust", "python": "Python", "android": "Android"}
+
+// catalogEntry is what a runner's index knows of repo: the viewer's
+// primary runner first, else any active member's that lists it.
+func (t *txn) catalogEntry(repo string) (wire.RepoInfo, bool, error) {
+ if t.catalogs == nil {
+ t.catalogs = map[string]wire.RepoInfo{}
+ members, err := t.members()
+ if err != nil {
+ return wire.RepoInfo{}, false, err
+ }
+ if t.viewer != "" {
+ members = append([]string{t.viewer}, members...)
+ }
+ for _, m := range members {
+ h, err := t.hello(m)
+ if err != nil {
+ return wire.RepoInfo{}, false, err
+ }
+ for _, e := range h.Catalog {
+ if _, ok := t.catalogs[e.Repo]; !ok {
+ t.catalogs[e.Repo] = e
+ }
+ }
+ }
+ }
+ e, ok := t.catalogs[repo]
+ return e, ok, nil
+}
+
+// projectFacts adds what the index knows of the project's repositories
+// and who is involved in it.
+func (t *txn) projectFacts(v *wire.Project, p projectRecord) error {
+ v.Stack, v.People = []string{}, []wire.PersonRef{}
+ for i := range v.Attachments {
+ a := &v.Attachments[i]
+ if a.Kind != wire.AttachmentRepo {
+ continue
+ }
+ e, ok, err := t.catalogEntry(a.Ref)
+ if err != nil {
+ return err
+ }
+ if !ok {
+ continue
+ }
+ a.DefaultBranch, a.HeadSHA, a.HeadSubject = e.DefaultBranch, e.HeadSHA, e.HeadSubject
+ if !e.UpdatedAt.IsZero() {
+ at := e.UpdatedAt
+ a.HeadAt = &at
+ }
+ }
+ if e, ok, err := t.catalogEntry(p.Repo); err != nil {
+ return err
+ } else if ok {
+ v.Description = e.Summary
+ for _, h := range e.Hints {
+ if n := stackNames[h]; n != "" && !slices.Contains(v.Stack, n) {
+ v.Stack = append(v.Stack, n)
+ }
+ }
+ c := wire.ProjectChecks{Here: e.Gate != "" && e.ChecksReason == "", Gate: e.Gate, Reason: e.ChecksReason}
+ if c.Reason == "" && e.Gate == "" {
+ c.Reason = wire.ChecksNone
+ }
+ v.Checks = &c
+ }
+ var creators []string
+ if err := t.db.Raw("SELECT creator FROM chat_tasks WHERE project_id = ? GROUP BY creator ORDER BY MIN(created_at), creator", p.ID).Scan(&creators).Error; err != nil {
+ return err
+ }
+ for _, a := range append([]string{p.AddedBy}, creators...) {
+ if a != "" && !slices.ContainsFunc(v.People, func(r wire.PersonRef) bool { return r.Address == a }) {
+ v.People = append(v.People, personRef(a))
+ }
+ }
+ return nil
+}
diff --git a/internal/equipo/chat/projects.go b/internal/equipo/chat/projects.go
index d3f3a7a4..0e6221ca 100644
--- a/internal/equipo/chat/projects.go
+++ b/internal/equipo/chat/projects.go
@@ -205,8 +205,10 @@ func (t *txn) projectView(p projectRecord) (wire.Project, error) {
}
v := wire.Project{ID: p.ID, Revision: p.Revision, Repo: p.Repo, Name: ProjectName(p.Repo), Title: title, State: p.State, AddedBy: p.AddedBy, CreatedAt: p.CreatedAt, UpdatedAt: p.UpdatedAt}
var err error
- v.Attachments, err = t.attachments(p.ID)
- return v, err
+ if v.Attachments, err = t.attachments(p.ID); err != nil {
+ return v, err
+ }
+ return v, t.projectFacts(&v, p)
}
func (t *txn) cardView(c cardRecord) (wire.Card, error) {
@@ -370,6 +372,7 @@ func (t *txn) isOwner(person string) error {
// Projects lists the team's active projects and the person's allowlist.
func (s *Store) Projects(ctx context.Context, person string) (out wire.ProjectList, err error) {
err = s.tx(ctx, func(t *txn) error {
+ t.viewer = person
if err := s.authority.CurrentPerson(ctx, t.db); err != nil {
return err
}
diff --git a/internal/equipo/chat/runner.go b/internal/equipo/chat/runner.go
index 1fc4e479..34636966 100644
--- a/internal/equipo/chat/runner.go
+++ b/internal/equipo/chat/runner.go
@@ -220,6 +220,8 @@ func (s *Store) Apply(ctx context.Context, l Lease, f wire.Frame, body any) erro
return t.answer(l, v)
case *wire.BranchReport:
return t.branchMoved(l, v)
+ case *wire.StepActivityReport:
+ return t.stepActivity(l, v)
}
return ErrInvalid
})
diff --git a/internal/equipo/chat/store.go b/internal/equipo/chat/store.go
index 187334e4..d47edd72 100644
--- a/internal/equipo/chat/store.go
+++ b/internal/equipo/chat/store.go
@@ -105,6 +105,10 @@ type txn struct {
ctx context.Context
db *gorm.DB
touched map[string]bool
+ // viewer is the person a read is for (their runner's catalog first);
+ // catalogs caches the runners' catalogs by repository.
+ viewer string
+ catalogs map[string]wire.RepoInfo
}
func (t *txn) now() time.Time { return t.s.now() }
diff --git a/internal/equipo/chat/stream.go b/internal/equipo/chat/stream.go
index 75532b0c..737c98cc 100644
--- a/internal/equipo/chat/stream.go
+++ b/internal/equipo/chat/stream.go
@@ -153,7 +153,7 @@ func (rc *runnerConn) read(ctx context.Context) websocket.StatusCode {
switch v := body.(type) {
case *wire.Hello:
err = store.Heartbeat(ctx, rc.lease, *v)
- case *wire.Sync, *wire.Ack, *wire.DeltaReport, *wire.Reply, *wire.TurnReport, *wire.ToolCall, *wire.ActivityReport, *wire.MoveIn, *wire.NotebookReport, *wire.StepReport, *wire.MergedReport, *wire.AnswerReport, *wire.BranchReport:
+ case *wire.Sync, *wire.Ack, *wire.DeltaReport, *wire.Reply, *wire.TurnReport, *wire.ToolCall, *wire.ActivityReport, *wire.MoveIn, *wire.NotebookReport, *wire.StepReport, *wire.MergedReport, *wire.AnswerReport, *wire.BranchReport, *wire.StepActivityReport:
err = store.Apply(ctx, rc.lease, f, body)
case *wire.LeaseCheck:
// Answered only while this connection holds the lease.
diff --git a/internal/equipo/chat/tasks.go b/internal/equipo/chat/tasks.go
index b13964ae..ddbd3808 100644
--- a/internal/equipo/chat/tasks.go
+++ b/internal/equipo/chat/tasks.go
@@ -55,6 +55,9 @@ type taskRecord struct {
MergeStrategy string
MergedWithoutChecks bool
MergedAt *time.Time
+ // DuplicateOf is an open task that read like this one when it was
+ // recorded anyway, or the task it was folded into.
+ DuplicateOf string
}
func (taskRecord) TableName() string { return "chat_tasks" }
@@ -111,6 +114,8 @@ type stepRecord struct {
MergeInto string
MergeStrategy string
WithoutChecks bool
+ // Activity is the newest activity lines of the attempt (JSON).
+ Activity string
}
func (stepRecord) TableName() string { return "chat_steps" }
@@ -270,7 +275,7 @@ func (t *txn) latestStep(taskID string) (stepRecord, bool, error) {
func stepView(s stepRecord) wire.Step {
return wire.Step{ID: s.ID, Revision: s.Revision, TaskID: s.TaskID, Index: s.Idx, Specialist: s.Specialist, State: s.State, Reason: s.Reason, Attempt: s.Attempt, BaseSHA: s.BaseSHA, CandidateSHA: s.CandidateSHA, Pushed: s.Pushed, Terminated: s.Terminated, Summary: s.Summary, LogTail: s.LogTail, StartedAt: s.StartedAt, FinishedAt: s.FinishedAt,
Round: s.Round, Family: s.Family, Account: s.Account, Verdict: s.Verdict, ReviewLabel: s.ReviewLabel, Findings: decodeFindings(s.Findings), Checks: s.Checks, Gate: s.Gate, ExitCode: s.ExitCode, Askable: s.Askable,
- Rebase: s.Rebase, MergeSHA: s.MergeSHA, Into: s.MergeInto, Strategy: s.MergeStrategy, WithoutChecks: s.WithoutChecks}
+ Rebase: s.Rebase, MergeSHA: s.MergeSHA, Into: s.MergeInto, Strategy: s.MergeStrategy, WithoutChecks: s.WithoutChecks, Activity: decodeActivity(s.Activity)}
}
// taskView is the task with its project, findings, steps and thread.
@@ -324,7 +329,7 @@ func (t *txn) taskView(k taskRecord) (wire.Task, error) {
if v.Reports, err = reportCount(t.db, k.ID); err != nil {
return v, err
}
- return v, nil
+ return v, t.taskExtras(&v, k, steps)
}
// members are the active team members, who all see team records.
@@ -342,7 +347,7 @@ func (t *txn) saveTask(k *taskRecord) error {
}
k.Revision++
k.UpdatedAt = t.now()
- if err := t.db.Model(&taskRecord{}).Where("id = ?", k.ID).Select("stage", "base_sha", "cancel_requested", "revision", "updated_at", "moved_from", "branch_head", "merged_sha", "merged_into", "merge_strategy", "merged_without_checks", "merged_at").Updates(k).Error; err != nil {
+ if err := t.db.Model(&taskRecord{}).Where("id = ?", k.ID).Select("stage", "base_sha", "cancel_requested", "revision", "updated_at", "moved_from", "branch_head", "merged_sha", "merged_into", "merge_strategy", "merged_without_checks", "merged_at", "duplicate_of").Updates(k).Error; err != nil {
return err
}
if wire.FinalStage(k.Stage) && !wire.FinalStage(before) {
@@ -378,7 +383,7 @@ func (t *txn) taskEvent(k taskRecord) error {
func (t *txn) saveStep(s *stepRecord, k *taskRecord) error {
s.Revision++
s.UpdatedAt = t.now()
- if err := t.db.Model(&stepRecord{}).Where("id = ?", s.ID).Select("state", "reason", "attempt", "base_sha", "candidate_sha", "pushed", "terminated", "summary", "log_tail", "started_at", "finished_at", "revision", "updated_at", "family", "account", "verdict", "review_label", "findings", "checks", "gate", "exit_code", "output", "republish", "from_attempt", "askable", "rebase", "from_base", "from_candidate", "merge_sha", "merge_into", "merge_strategy", "without_checks").Updates(s).Error; err != nil {
+ if err := t.db.Model(&stepRecord{}).Where("id = ?", s.ID).Select("state", "reason", "attempt", "base_sha", "candidate_sha", "pushed", "terminated", "summary", "log_tail", "started_at", "finished_at", "revision", "updated_at", "family", "account", "verdict", "review_label", "findings", "checks", "gate", "exit_code", "output", "republish", "from_attempt", "askable", "rebase", "from_base", "from_candidate", "merge_sha", "merge_into", "merge_strategy", "without_checks", "activity").Updates(s).Error; err != nil {
return err
}
members, err := t.members()
@@ -432,6 +437,17 @@ func (t *txn) recordTask(r turnRecord, repo, title, brief string, separate bool)
now := t.now()
k := taskRecord{ID: newTaskID(), ProjectID: p.ID, Title: title, Brief: brief, Stage: wire.StageNoted, Creator: r.Person, TurnID: r.ID, Revision: 1, CreatedAt: now, UpdatedAt: now}
k.Branch = wire.TaskBranch(k.ID, title)
+ if separate {
+ // Recorded anyway: the most similar open task is named as a
+ // possible duplicate, for the person to fold it if it is one.
+ similar, err := t.similarTasks(p.ID, title, brief)
+ if err != nil {
+ return wire.ToolResult{}, err
+ }
+ if len(similar) > 0 {
+ k.DuplicateOf = similar[0].ID
+ }
+ }
if err := t.db.Create(&k).Error; err != nil {
return wire.ToolResult{}, err
}
@@ -1031,6 +1047,7 @@ func (s *Store) RetryTask(ctx context.Context, person, id string) (attempt int64
st.Republish = republish
st.State, st.Reason, st.Pushed, st.Terminated, st.Summary, st.LogTail, st.StartedAt, st.FinishedAt = wire.StepQueued, "", false, false, "", "", nil, nil
st.Verdict, st.ReviewLabel, st.Findings, st.Checks, st.Gate, st.ExitCode, st.Output, st.Askable = "", "", "", "", "", nil, "", false
+ st.Activity = ""
if st.Specialist == wire.SpecialistEngineering && !republish {
// Engineering runs again from the step's base: a new candidate.
st.CandidateSHA = ""
diff --git a/internal/equipo/migrations/0048_thin_ux1.sql b/internal/equipo/migrations/0048_thin_ux1.sql
new file mode 100644
index 00000000..7c543cd1
--- /dev/null
+++ b/internal/equipo/migrations/0048_thin_ux1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE chat_steps ADD COLUMN activity text;
+ALTER TABLE chat_tasks ADD COLUMN duplicate_of text;
diff --git a/internal/equipo/migrations/schema.sql b/internal/equipo/migrations/schema.sql
index 1f4dee4b..5cf0a7bd 100644
--- a/internal/equipo/migrations/schema.sql
+++ b/internal/equipo/migrations/schema.sql
@@ -592,9 +592,9 @@ CREATE TABLE chat_coordinators (person text PRIMARY KEY, state text, turn_id tex
CREATE TABLE chat_notebooks (person text PRIMARY KEY, entries text, revision integer, updated_at datetime);
CREATE INDEX chat_card_task ON chat_cards(task_id);
CREATE TABLE chat_project_attachments (project_id text, kind text, ref text, name text, created_at datetime, PRIMARY KEY (project_id, kind, ref));
-CREATE TABLE chat_tasks (id text PRIMARY KEY, project_id text, title text, brief text, stage text, branch text, base_sha text, creator text, turn_id text, cancel_requested numeric, revision integer, created_at datetime, updated_at datetime, watching text, moved_from text, branch_head text, merge_asked text, merged_sha text, merged_into text, merge_strategy text, merged_without_checks numeric, merged_at datetime);
+CREATE TABLE chat_tasks (id text PRIMARY KEY, project_id text, title text, brief text, stage text, branch text, base_sha text, creator text, turn_id text, cancel_requested numeric, revision integer, created_at datetime, updated_at datetime, watching text, moved_from text, branch_head text, merge_asked text, merged_sha text, merged_into text, merge_strategy text, merged_without_checks numeric, merged_at datetime, duplicate_of text);
CREATE INDEX chat_task_project ON chat_tasks(project_id);
-CREATE TABLE chat_steps (id text PRIMARY KEY, task_id text, idx integer, specialist text, person text, state text, reason text, attempt integer, base_sha text, candidate_sha text, pushed numeric, terminated numeric, summary text, log_tail text, started_at datetime, finished_at datetime, revision integer, created_at datetime, updated_at datetime, round integer, family text, account text, verdict text, review_label text, findings text, checks text, gate text, exit_code integer, output text, republish numeric, from_attempt integer, askable numeric, rebase numeric, from_base text, from_candidate text, merge_sha text, merge_into text, merge_strategy text, without_checks numeric);
+CREATE TABLE chat_steps (id text PRIMARY KEY, task_id text, idx integer, specialist text, person text, state text, reason text, attempt integer, base_sha text, candidate_sha text, pushed numeric, terminated numeric, summary text, log_tail text, started_at datetime, finished_at datetime, revision integer, created_at datetime, updated_at datetime, round integer, family text, account text, verdict text, review_label text, findings text, checks text, gate text, exit_code integer, output text, republish numeric, from_attempt integer, askable numeric, rebase numeric, from_base text, from_candidate text, merge_sha text, merge_into text, merge_strategy text, without_checks numeric, activity text);
CREATE INDEX chat_step_task ON chat_steps(task_id);
CREATE TABLE chat_task_entries (id text PRIMARY KEY, task_id text, idempotency_key text, kind text, author text, text text, repo text, path text, line integer, created_at datetime);
CREATE INDEX chat_entry_task ON chat_task_entries(task_id);
diff --git a/internal/fakeclaude/fake.go b/internal/fakeclaude/fake.go
index 32e902ed..fb81219d 100644
--- a/internal/fakeclaude/fake.go
+++ b/internal/fakeclaude/fake.go
@@ -41,7 +41,9 @@
// "escape:<path>" asks for Write on an absolute path and reports the
// answer; "stepsleep:<ms>" pauses before editing. In a rebase round each
// "conflict:<path>" line has its conflicts resolved to the task's side.
-// The reply is a summary.
+// The reply is a summary. Before anything else (and before
+// "stepsleep") it reads each file it will edit, so the step shows its
+// activity while it runs.
//
// Review: a prompt starting "[Equipo: review]" reads the change and calls
// submit_review: "review:approve" (the default), "review:changes:<path>|
@@ -305,6 +307,13 @@ var stepSleep = regexp.MustCompile(`stepsleep:([0-9]+)`)
// engineer plays an Engineering step: permission first, then the edit in
// the working directory (the namespace's /workspace).
func (f *fake) engineer(prompt string, turn int, emit func(any)) string {
+ read := map[string]bool{}
+ for i, m := range editWord.FindAllStringSubmatch(prompt, -1) {
+ if path := filepath.Join("/workspace", filepath.Clean("/"+m[1])); !read[path] {
+ read[path] = true
+ f.readTool(fmt.Sprintf("toolu_fake_%d_er%d", turn, i), path, emit)
+ }
+ }
if m := stepSleep.FindStringSubmatch(prompt); m != nil {
ms, _ := strconv.Atoi(m[1])
time.Sleep(time.Duration(ms) * time.Millisecond)
@@ -369,6 +378,12 @@ func (f *fake) engineer(prompt string, turn int, emit func(any)) string {
return strings.Join(done, " ")
}
+// readTool shows a Read of path as the CLI streams it (the read itself
+// needs no permission inside the workspace).
+func (f *fake) readTool(id, path string, emit func(any)) {
+ emit(map[string]any{"type": "assistant", "session_id": f.session, "parent_tool_use_id": nil, "message": map[string]any{"model": f.model, "id": "msg_" + id, "type": "message", "role": "assistant", "content": []any{map[string]any{"type": "tool_use", "id": id, "name": "Read", "input": map[string]any{"file_path": path}}}}, "uuid": "assistant-" + id})
+}
+
var (
reviewChanges = regexp.MustCompile(`review:changes:([^|\n]+)\|([0-9]+)\|([^\n;]*)`)
reviewNeed = regexp.MustCompile(`review:need:([^|\n]+)\|([^|\n]+)\|([^\n;]*)`)
@@ -379,6 +394,9 @@ var (
// reviewer plays a Review step: reads what the words name in the
// working directory and gives its verdict through submit_review.
func (f *fake) reviewer(prompt string, turn int, emit func(any)) string {
+ for i, m := range append(reviewNeed.FindAllStringSubmatch(prompt, -1), reviewChanges.FindAllStringSubmatch(prompt, -1)...) {
+ f.readTool(fmt.Sprintf("toolu_fake_%d_rr%d", turn, i), filepath.Join("/workspace", filepath.Clean("/"+m[1])), emit)
+ }
if m := reviewSleep.FindStringSubmatch(prompt); m != nil {
ms, _ := strconv.Atoi(m[1])
time.Sleep(time.Duration(ms) * time.Millisecond)
diff --git a/internal/headless/engineering_test.go b/internal/headless/engineering_test.go
index 4fb7dcb8..ce4567bb 100644
--- a/internal/headless/engineering_test.go
+++ b/internal/headless/engineering_test.go
@@ -150,7 +150,19 @@ func scenarioStepCrash(t *testing.T, env *Env) {
}
sent := s.send(t, text)
id := s.taskOf(t, sent.Turn.ID)
- s.step(t, id, 5*time.Minute, wire.StepRunning)
+ running := s.step(t, id, 5*time.Minute, wire.StepRunning)
+ if !env.Live {
+ // What Engineering started shows while it runs: the fake reads the
+ // file it will edit before it sleeps.
+ s.wait(t, "step activity while running", time.Minute, func(c *thintest.Conversation) bool {
+ for _, a := range c.StepActivity[running.ID] {
+ if n := len(a.Activity); n > 0 && a.Activity[n-1].Kind == wire.ActivityRead && a.Activity[n-1].Subject == "README.md" {
+ return c.Steps[running.ID].State == wire.StepRunning
+ }
+ }
+ return false
+ })
+ }
// Let the step's process start before the kill.
time.Sleep(1500 * time.Millisecond)
env.KillRunner(t)
@@ -172,6 +184,15 @@ func scenarioStepCrash(t *testing.T, env *Env) {
t.Fatalf("attempt 2: %+v", done)
}
if !env.Live {
+ // The step keeps its last lines: attempt 2's read and edit.
+ k, err := env.Client.Task(s.ctx, id)
+ if err != nil {
+ t.Fatal(err)
+ }
+ lines := k.Steps[0].Activity
+ if len(lines) != 2 || lines[0].Kind != wire.ActivityRead || lines[1].Kind != wire.ActivityEdit || lines[1].Subject != "README.md" {
+ t.Fatalf("kept activity %+v", lines)
+ }
if got := forgeHead(t, env.ForgePath("amadan.net/oficina/sample"), wire.TaskBranch(id, "Fix the README typo")); got != done.CandidateSHA {
t.Fatalf("branch at %q, want %s", got, done.CandidateSHA)
}
diff --git a/internal/plan3test/person_api_contract_test.go b/internal/plan3test/person_api_contract_test.go
index 72e379ca..9bad4358 100644
--- a/internal/plan3test/person_api_contract_test.go
+++ b/internal/plan3test/person_api_contract_test.go
@@ -56,7 +56,7 @@ func personAPIContractCoverage(t *testing.T) {
f := newFixture(t)
registered := map[string]bool{}
// Thin v1 conversation routes are contracted by internal/wire fixtures.
- thin := map[string]bool{"GET /messages": true, "POST /messages": true, "GET /turns/{id}": true, "POST /turns/{id}/cancel": true, "GET /snapshot": true, "GET /events": true, "DELETE /projects/{id}": true, "POST /cards/{id}/answer": true, "GET /notebook": true, "POST /notebook/reset": true, "POST /tasks/{id}/retry": true, "POST /tasks/{id}/thread": true, "GET /steps/{id}/log": true, "POST /tasks/{id}/questions": true, "POST /questions/{id}/cancel": true}
+ thin := map[string]bool{"GET /messages": true, "POST /messages": true, "GET /turns/{id}": true, "POST /turns/{id}/cancel": true, "GET /snapshot": true, "GET /events": true, "DELETE /projects/{id}": true, "POST /cards/{id}/answer": true, "GET /notebook": true, "POST /notebook/reset": true, "POST /tasks/{id}/retry": true, "POST /tasks/{id}/duplicate": true, "POST /tasks/{id}/thread": true, "GET /steps/{id}/log": true, "POST /tasks/{id}/questions": true, "POST /questions/{id}/cancel": true}
must(t, chi.Walk(f.Store.PersonAPIHandler().(chi.Routes), func(method, path string, _ http.Handler, _ ...func(http.Handler) http.Handler) error {
if thin[method+" "+path] {
return nil
diff --git a/internal/runner/thin/bridge.go b/internal/runner/thin/bridge.go
index 4d448a62..5595c5f5 100644
--- a/internal/runner/thin/bridge.go
+++ b/internal/runner/thin/bridge.go
@@ -5,6 +5,7 @@ import (
"crypto/rand"
"encoding/json"
"log/slog"
+ "slices"
"strconv"
"strings"
"sync"
@@ -224,8 +225,10 @@ type noteInput struct {
}
// checkEntries builds the new notebook: kept entries unchanged, new ones
-// only with a provenance the runner saw this turn.
-func checkEntries(desk *Desk, facts *turnFacts, in []noteInput) ([]wire.NotebookEntry, string) {
+// only with a provenance the runner saw this turn. A person or own entry
+// may name the project it is about by a repository known reports in the
+// catalog (no path).
+func checkEntries(desk *Desk, facts *turnFacts, in []noteInput, known func(repo string) bool) ([]wire.NotebookEntry, string) {
old := map[string]wire.NotebookEntry{}
for _, e := range desk.Entries() {
old[e.ID] = e
@@ -247,19 +250,25 @@ func checkEntries(desk *Desk, facts *turnFacts, in []noteInput) ([]wire.Notebook
}
e := wire.NotebookEntry{Source: n.Source, Text: text, At: time.Now().UTC()}
switch n.Source {
- case wire.NotePerson:
- if n.Repo != "" || n.Path != "" || !facts.saidByPerson(text) {
+ case wire.NotePerson, wire.NoteOwn:
+ if n.Source == wire.NotePerson && !facts.saidByPerson(text) {
return nil, at + "a person entry quotes the person's own words from this turn exactly; anything else is your own note."
}
+ if n.Path != "" {
+ return nil, at + "a person or own entry has no path; repo may name the project's repository it is about."
+ }
+ if n.Repo != "" {
+ repo := "amadan.net/" + strings.TrimPrefix(strings.TrimSpace(n.Repo), "amadan.net/")
+ if known == nil || !known(repo) {
+ return nil, at + "repo names a repository you can reach, for the project the note is about."
+ }
+ e.Repo = strings.TrimPrefix(repo, "amadan.net/")
+ }
case wire.NoteRepo:
if !facts.wasRead(n.Repo, n.Path) {
return nil, at + "a repo entry names the repo and path of a file you read with read_file in this turn."
}
e.Repo, e.Path = strings.TrimPrefix(n.Repo, "amadan.net/"), strings.Trim(n.Path, "/")
- case wire.NoteOwn:
- if n.Repo != "" || n.Path != "" {
- return nil, at + "your own note has no repo or path."
- }
default:
return nil, at + "source is person, repo or own."
}
@@ -273,6 +282,14 @@ func checkEntries(desk *Desk, facts *turnFacts, in []noteInput) ([]wire.Notebook
return out, ""
}
+// catalogHas reports whether the index lists repo.
+func (b *bridge) catalogHas(repo string) bool {
+ if b.Index == nil {
+ return false
+ }
+ return slices.ContainsFunc(b.Index.Catalog(), func(e wire.RepoInfo) bool { return e.Repo == repo })
+}
+
// notes reads or writes the person's notebook once the instance
// authorised the call for this turn (on the entry count and size). New
// entries need a provenance the runner saw itself; the owner sees the
@@ -304,7 +321,7 @@ func (b *bridge) notes(ctx context.Context, person string, call wire.ToolCall) (
return res.Text, true
}
var why string
- if entries, why = checkEntries(desk, factsFrom(ctx), in.Entries); why != "" {
+ if entries, why = checkEntries(desk, factsFrom(ctx), in.Entries, b.catalogHas); why != "" {
return "Nothing was saved. " + why, true
}
if err := desk.SaveEntries(entries); err != nil {
diff --git a/internal/runner/thin/claude.go b/internal/runner/thin/claude.go
index ac9ef7ce..72f1891c 100644
--- a/internal/runner/thin/claude.go
+++ b/internal/runner/thin/claude.go
@@ -660,7 +660,7 @@ func (c *claudeCoordinator) settled(kind string, ns []string, catalog []wire.Rep
if err != nil {
return err
}
- es = append(es, wire.NotebookEntry{ID: id, Source: wire.NoteOwn, Text: clip(strings.TrimPrefix(e.Repo, "amadan.net/")+" is reachable: "+e.Summary, wire.MaxEntryBytes), At: time.Now().UTC()})
+ es = append(es, wire.NotebookEntry{ID: id, Source: wire.NoteOwn, Repo: strings.TrimPrefix(e.Repo, "amadan.net/"), Text: clip(strings.TrimPrefix(e.Repo, "amadan.net/")+" is reachable: "+e.Summary, wire.MaxEntryBytes), At: time.Now().UTC()})
}
if err := c.desk.SaveEntries(es); err != nil {
return err
diff --git a/internal/runner/thin/desk_test.go b/internal/runner/thin/desk_test.go
index ecdbca2f..19069c37 100644
--- a/internal/runner/thin/desk_test.go
+++ b/internal/runner/thin/desk_test.go
@@ -23,7 +23,7 @@ func TestNotebookProvenance(t *testing.T) {
person := newTurnFacts(wire.TurnPerson, []string{"I like short replies. Please keep it brief.", "Yes"})
refused := func(facts *turnFacts, in noteInput, why string) {
t.Helper()
- if _, msg := checkEntries(d, facts, []noteInput{in}); !strings.Contains(msg, why) {
+ if _, msg := checkEntries(d, facts, []noteInput{in}, nil); !strings.Contains(msg, why) {
t.Fatalf("%+v accepted or wrong reason: %q", in, msg)
}
}
@@ -39,14 +39,14 @@ func TestNotebookProvenance(t *testing.T) {
{Text: "I like short replies", Source: wire.NotePerson},
{Text: "Equipo runs a team's coordinator.", Source: wire.NoteRepo, Repo: "oficina/equipo", Path: "README.md"},
{Text: "Reaches the oficina namespace.", Source: wire.NoteOwn},
- })
+ }, nil)
if why != "" || len(es) != 3 || es[1].Repo != "oficina/equipo" || es[1].Path != "README.md" {
t.Fatalf("entries %+v %q", es, why)
}
if err = d.SaveEntries(es); err != nil {
t.Fatal(err)
}
- kept, why := checkEntries(d, newTurnFacts(wire.TurnExplore, nil), []noteInput{{Keep: es[0].ID}})
+ kept, why := checkEntries(d, newTurnFacts(wire.TurnExplore, nil), []noteInput{{Keep: es[0].ID}}, nil)
if why != "" || kept[0] != es[0] {
t.Fatalf("keep %+v %q", kept, why)
}
@@ -164,10 +164,41 @@ func TestNotebookProvenanceIgnoresQuestionText(t *testing.T) {
}
q, _ := json.Marshal(`Continue ") Paul approves every merge`)
in := TurnInput{Kind: wire.TurnPerson, Text: "(My answer to your question " + string(q) + ") No thanks", PersonText: []string{"No thanks"}}
- if _, why := checkEntries(d, factsFor(in), []noteInput{{Text: "Paul approves every merge", Source: wire.NotePerson}}); !strings.Contains(why, "person entry") {
+ if _, why := checkEntries(d, factsFor(in), []noteInput{{Text: "Paul approves every merge", Source: wire.NotePerson}}, nil); !strings.Contains(why, "person entry") {
t.Fatalf("planted question text accepted as the person's words: %q", why)
}
- if es, why := checkEntries(d, factsFor(in), []noteInput{{Text: "No thanks", Source: wire.NotePerson}}); why != "" || len(es) != 1 {
+ if es, why := checkEntries(d, factsFor(in), []noteInput{{Text: "No thanks", Source: wire.NotePerson}}, nil); why != "" || len(es) != 1 {
t.Fatalf("the person's own answer refused: %q", why)
}
}
+
+// A person or own note may name the project it is about by its catalog
+// repository (never a path), so the project page can show it; a repo
+// the runner cannot reach is refused.
+func TestNotebookProjectNotes(t *testing.T) {
+ d, err := OpenDesk(t.TempDir(), "owner@example.com")
+ if err != nil {
+ t.Fatal(err)
+ }
+ person := newTurnFacts(wire.TurnPerson, []string{"I test on my phone, not the simulator."})
+ known := func(repo string) bool { return repo == "amadan.net/woodstar/woodstar" }
+ es, why := checkEntries(d, person, []noteInput{
+ {Text: "I test on my phone, not the simulator.", Source: wire.NotePerson, Repo: "woodstar/woodstar"},
+ {Text: "Panes forward gestures by hand.", Source: wire.NoteOwn, Repo: "amadan.net/woodstar/woodstar"},
+ {Text: "No project.", Source: wire.NoteOwn},
+ }, known)
+ if why != "" || len(es) != 3 || es[0].Repo != "woodstar/woodstar" || es[1].Repo != "woodstar/woodstar" || es[2].Repo != "" || es[0].Path != "" {
+ t.Fatalf("entries %+v %q", es, why)
+ }
+ for _, in := range []noteInput{
+ {Text: "Secret.", Source: wire.NoteOwn, Repo: "oficina/secret"},
+ {Text: "Panes.", Source: wire.NoteOwn, Repo: "woodstar/woodstar", Path: "README.md"},
+ } {
+ if _, why := checkEntries(d, person, []noteInput{in}, known); why == "" {
+ t.Fatalf("accepted %+v", in)
+ }
+ }
+ if _, why := checkEntries(d, person, []noteInput{{Text: "Panes.", Source: wire.NoteOwn, Repo: "woodstar/woodstar"}}, nil); why == "" {
+ t.Fatal("accepted a project without a catalog")
+ }
+}
diff --git a/internal/runner/thin/engineer.go b/internal/runner/thin/engineer.go
index e8e4af72..03195500 100644
--- a/internal/runner/thin/engineer.go
+++ b/internal/runner/thin/engineer.go
@@ -61,10 +61,12 @@ type Engineer struct {
// Delta and Activity forward an answer's streamed text and activity
// (ask the implementer); Retention bounds an unused kept session and
// MaxAnswer one answer.
- Delta func(wire.DeltaReport)
- Activity func(wire.ActivityReport)
- Retention time.Duration
- MaxAnswer time.Duration
+ Delta func(wire.DeltaReport)
+ Activity func(wire.ActivityReport)
+ // StepActivity forwards what an Engineering or Review step started.
+ StepActivity func(wire.StepActivityReport)
+ Retention time.Duration
+ MaxAnswer time.Duration
// Host names this runner to the hub when it merges (the machine label).
Host string
}
@@ -168,7 +170,7 @@ func (e *Engineer) Exec(ctx context.Context, r stepRow, progress func(wire.StepR
return fail("account_unavailable", true)
}
rep.Family, rep.Account = b.Family, b.LocalID
- res := e.run(ctx, r, tree, specialistRun{action: "implement", binding: b, tools: stepTools, names: []string{"submit_candidate", "ask_person", "submit_render"}, permission: claude.StepPermission, call: func(context.Context, string, string, json.RawMessage) (string, bool) { return stepToolText, false }, prompt: prompt, keep: e.keepDir(r)})
+ res := e.run(ctx, r, tree, specialistRun{action: "implement", binding: b, tools: stepTools, names: []string{"submit_candidate", "ask_person", "submit_render"}, permission: claude.StepPermission, call: func(context.Context, string, string, json.RawMessage) (string, bool) { return stepToolText, false }, prompt: prompt, keep: e.keepDir(r), activity: e.stepActivity(r)})
rep.Summary, rep.LogTail = clip(res.summary, wire.MaxStepSummary), res.tail
kept := e.recordKept(ctx, r, b.LocalID, res, "")
if !res.terminated {
@@ -397,8 +399,10 @@ type specialistRun struct {
// stream receives streamed text and activity; limit bounds the run
// (0: the step bound); noLog keeps no step log.
stream *answerStream
- limit time.Duration
- noLog bool
+ // activity receives each tool the specialist starts (kind, subject).
+ activity func(kind, subject string)
+ limit time.Duration
+ noLog bool
// record keeps the namespace the run started in, against its own
// attempt (a step's, or a question's); nil records the step's.
record func(ctx context.Context, nsID string) error
@@ -510,7 +514,7 @@ func (e *Engineer) run(ctx context.Context, r stepRow, tree workspace.TaskTree,
logFile = e.openLog(r)
}
defer logFile.Close()
- res := e.converse(ctx, proc, session, policy, b.Model, frames, logFile, limit, spec.prompt, spec.stream)
+ res := e.converse(ctx, proc, session, policy, b.Model, frames, logFile, limit, spec.prompt, spec.stream, spec.activity)
res.session = session
res.terminated = stopStep(func() { proc.Stdin().Close() }, exited, kill, ctx.Err() == nil && res.reason == "", 10*time.Second, 30*time.Second)
if !res.terminated {
@@ -558,8 +562,9 @@ func stopStep(closeStdin func(), exited <-chan error, kill func(), graceful bool
}
// converse sends the prompt and reads frames to the result.
-func (e *Engineer) converse(ctx context.Context, proc provider.Process, session string, policy provider.Policy, model string, frames <-chan []byte, logFile io.Writer, limit time.Duration, prompt string, stream *answerStream) stepResult {
+func (e *Engineer) converse(ctx context.Context, proc provider.Process, session string, policy provider.Policy, model string, frames <-chan []byte, logFile io.Writer, limit time.Duration, prompt string, stream *answerStream, activity func(kind, subject string)) stepResult {
tail := &stepTail{}
+ lastActivity := ""
raw, err := claude.UserEnvelope(session, prompt)
if err != nil {
return stepResult{reason: "provider_rejected"}
@@ -611,6 +616,14 @@ func (e *Engineer) converse(ctx context.Context, proc provider.Process, session
}
case "message":
tail.assistant(ev.Payload)
+ if activity != nil {
+ for _, a := range toolActivity(ev.Payload) {
+ if key := a[0] + "\x00" + a[1]; key != lastActivity {
+ lastActivity = key
+ activity(a[0], a[1])
+ }
+ }
+ }
case "message.delta":
if stream != nil {
stream.event(ev.Payload)
@@ -657,6 +670,61 @@ func (e *Engineer) forget(id string) {
}
}
+// stepActivity sends a step's activity lines for its attempt, when the
+// runner forwards them.
+func (e *Engineer) stepActivity(r stepRow) func(kind, subject string) {
+ if e.StepActivity == nil {
+ return nil
+ }
+ return func(kind, subject string) {
+ e.StepActivity(wire.StepActivityReport{TaskID: r.TaskID, StepID: r.StepID, Attempt: r.Attempt, Kind: kind, Subject: subject})
+ }
+}
+
+// toolActivity names each tool an assistant message starts: what kind of
+// thing it does and its file, pattern or command (first line, clipped).
+func toolActivity(raw []byte) [][2]string {
+ var v struct {
+ Message struct {
+ Content []struct {
+ Type string `json:"type"`
+ Name string `json:"name"`
+ Input struct {
+ Path string `json:"file_path"`
+ Notebook string `json:"notebook_path"`
+ Pattern string `json:"pattern"`
+ Command string `json:"command"`
+ } `json:"input"`
+ } `json:"content"`
+ } `json:"message"`
+ }
+ if json.Unmarshal(raw, &v) != nil {
+ return nil
+ }
+ var out [][2]string
+ for _, c := range v.Message.Content {
+ if c.Type != "tool_use" {
+ continue
+ }
+ kind, subject := wire.ActivityOther, ""
+ switch strings.TrimPrefix(c.Name, "mcp__equipo__") {
+ case "Read":
+ kind, subject = wire.ActivityRead, c.Input.Path
+ case "Glob", "Grep":
+ kind, subject = wire.ActivitySearch, c.Input.Pattern
+ case "Edit", "Write", "MultiEdit":
+ kind, subject = wire.ActivityEdit, c.Input.Path
+ case "NotebookEdit":
+ kind, subject = wire.ActivityEdit, firstNonEmpty(c.Input.Notebook, c.Input.Path)
+ case "Bash":
+ kind, subject = wire.ActivityRun, c.Input.Command
+ }
+ subject = strings.TrimSpace(strings.SplitN(strings.TrimSpace(subject), "\n", 2)[0])
+ out = append(out, [2]string{kind, clip(strings.TrimPrefix(subject, "/workspace/"), wire.MaxActivitySubject)})
+ }
+ return out
+}
+
// stepTail keeps the last lines a person can follow: the tools the
// specialist used (name and file, or the command's first line) and its
// text, bounded.
diff --git a/internal/runner/thin/index.go b/internal/runner/thin/index.go
index b6f01cbd..c88786d0 100644
--- a/internal/runner/thin/index.go
+++ b/internal/runner/thin/index.go
@@ -12,6 +12,7 @@ import (
"path"
"path/filepath"
"regexp"
+ "runtime"
"slices"
"strconv"
"strings"
@@ -232,11 +233,22 @@ func (x *Index) entry(ctx context.Context, repo string) (wire.RepoInfo, error) {
if err = x.Clones.Shallow(fctx, repo, branch); err != nil {
return wire.RepoInfo{}, err
}
- dir := x.Clones.Path(repo)
+ return x.describe(ctx, repo, branch, x.Clones.Path(repo)), nil
+}
+
+// describe reads one clone's default branch: its newest commit, names,
+// hints, the checks gate and whether this runner can run it.
+func (x *Index) describe(ctx context.Context, repo, branch, dir string) wire.RepoInfo {
e := wire.RepoInfo{Repo: repo, DefaultBranch: branch, Names: []string{}, Hints: []string{}}
- if out, err := x.git(ctx, dir, "log", "-1", "--format=%ct", "HEAD"); err == nil {
- if sec, err := strconv.ParseInt(strings.TrimSpace(string(out)), 10, 64); err == nil {
- e.UpdatedAt = time.Unix(sec, 0).UTC()
+ if out, err := x.git(ctx, dir, "log", "-1", "--format=%ct%x00%H%x00%s", "HEAD"); err == nil {
+ if f := strings.SplitN(strings.TrimSpace(string(out)), "\x00", 3); len(f) == 3 {
+ if sec, err := strconv.ParseInt(f[0], 10, 64); err == nil {
+ e.UpdatedAt = time.Unix(sec, 0).UTC()
+ }
+ if objectName.MatchString(f[1]) {
+ e.HeadSHA = f[1]
+ }
+ e.HeadSubject = clip(strings.ToValidUTF8(f[2], ""), wire.MaxRepoString)
}
}
files, _ := x.git(ctx, dir, "ls-tree", "-r", "--name-only", "HEAD")
@@ -264,7 +276,36 @@ func (x *Index) entry(ctx context.Context, repo string) (wire.RepoInfo, error) {
names = append(names, appNames(list)...)
e.Names = bounded(names, wire.MaxRepoNames)
e.Hints = bounded(hints(list, read), wire.MaxRepoHints)
- return e, nil
+ var gateText string
+ e.Gate, gateText = listedGate(list, read)
+ if runtime.GOOS != "darwin" && needsMacOS(list, gateText) {
+ e.ChecksReason = "needs_macos"
+ }
+ return e
+}
+
+// listedGate is the checks gate a tree holds, in Amadan's order (as
+// findGate finds it in a checked-out tree), and the text of its files.
+func listedGate(list []string, read func(string) string) (name, text string) {
+ var ciD strings.Builder
+ for _, f := range list {
+ if rest, ok := strings.CutPrefix(f, ".amadan/ci.d/"); ok && rest != "" && !strings.Contains(rest, "/") {
+ ciD.WriteString(read(f) + "\n")
+ name = ".amadan/ci.d"
+ }
+ }
+ if name != "" {
+ return name, ciD.String()
+ }
+ if slices.Contains(list, ".amadan/ci") {
+ return ".amadan/ci", read(".amadan/ci")
+ }
+ for _, f := range []string{"GNUmakefile", "makefile", "Makefile"} {
+ if s := read(f); s != "" && makeCI.MatchString(s) {
+ return "make ci", s
+ }
+ }
+ return "", ""
}
func (x *Index) git(ctx context.Context, dir string, args ...string) ([]byte, error) {
diff --git a/internal/runner/thin/index_facts_test.go b/internal/runner/thin/index_facts_test.go
new file mode 100644
index 00000000..8713ff9f
--- /dev/null
+++ b/internal/runner/thin/index_facts_test.go
@@ -0,0 +1,75 @@
+package thin
+
+import (
+ "context"
+ "os"
+ "path/filepath"
+ "runtime"
+ "strings"
+ "testing"
+)
+
+// The index says what each repository's default branch holds now: its
+// newest commit, the checks gate in Amadan's order, and whether this
+// runner could run the checks (a Linux runner cannot check Swift).
+func TestIndexDescribesFacts(t *testing.T) {
+ root := t.TempDir()
+ c := &Clones{Root: filepath.Join(root, "work"), Git: "git"}
+ x := &Index{Clones: c}
+ for _, tc := range []struct {
+ repo string
+ files map[string]string
+ gate string
+ reason string
+ }{
+ {"amadan.net/a/ios", map[string]string{".amadan/ci.d/10-test": "#!/bin/sh\nmake test\n", "App/View.swift": "import SwiftUI\n", "Makefile": "ci:\n\tgo test\n"}, ".amadan/ci.d", "needs_macos"},
+ {"amadan.net/a/go", map[string]string{"Makefile": "build:\n\tgo build\nci: build\n\tgo test ./...\n", "go.mod": "module x\n"}, "make ci", ""},
+ {"amadan.net/a/ci", map[string]string{".amadan/ci": "#!/bin/sh\nxcodebuild test\n"}, ".amadan/ci", "needs_macos"},
+ {"amadan.net/a/none", map[string]string{"README.md": "# None\n\nNothing to check.\n"}, "", ""},
+ } {
+ seed := filepath.Join(root, "seed", filepath.Base(tc.repo))
+ for name, body := range tc.files {
+ os.MkdirAll(filepath.Dir(filepath.Join(seed, name)), 0700)
+ if err := os.WriteFile(filepath.Join(seed, name), []byte(body), 0600); err != nil {
+ t.Fatal(err)
+ }
+ }
+ hostileGit(t, seed, "init", "-q", "-b", "main")
+ hostileGit(t, seed, "add", "-A")
+ hostileGit(t, seed, "commit", "-q", "-m", "First line of "+tc.repo+"\n\nThe body.")
+ dir := c.Path(tc.repo)
+ os.MkdirAll(filepath.Dir(dir), 0700)
+ hostileGit(t, root, "clone", "-q", "--bare", seed, dir)
+ e := x.describe(context.Background(), tc.repo, "main", dir)
+ if len(e.HeadSHA) != 40 || e.HeadSubject != "First line of "+tc.repo || e.UpdatedAt.IsZero() {
+ t.Fatalf("%s head: %q %q %v", tc.repo, e.HeadSHA, e.HeadSubject, e.UpdatedAt)
+ }
+ want := tc.reason
+ if runtime.GOOS == "darwin" {
+ want = ""
+ }
+ if e.Gate != tc.gate || e.ChecksReason != want {
+ t.Fatalf("%s: gate %q reason %q, want %q %q", tc.repo, e.Gate, e.ChecksReason, tc.gate, want)
+ }
+ if strings.Contains(e.HeadSubject, "\x00") {
+ t.Fatalf("subject %q", e.HeadSubject)
+ }
+ }
+}
+
+// A step's activity names each tool its specialist starts: reading,
+// searching, editing or running, with the file, pattern or the command's
+// first line, never the workspace's own path.
+func TestToolActivity(t *testing.T) {
+ raw := `{"type":"assistant","message":{"content":[{"type":"text","text":"Looking."},{"type":"tool_use","name":"Read","input":{"file_path":"/workspace/panes/swipe.go"}},{"type":"tool_use","name":"Grep","input":{"pattern":"EdgeSwipe"}},{"type":"tool_use","name":"Edit","input":{"file_path":"/workspace/panes/swipe.go","old_string":"a","new_string":"b"}},{"type":"tool_use","name":"Bash","input":{"command":"go test ./panes\nrm -rf /"}},{"type":"tool_use","name":"mcp__equipo__submit_candidate","input":{}}]}}`
+ got := toolActivity([]byte(raw))
+ want := [][2]string{{"read", "panes/swipe.go"}, {"search", "EdgeSwipe"}, {"edit", "panes/swipe.go"}, {"run", "go test ./panes"}, {"other", ""}}
+ if len(got) != len(want) {
+ t.Fatalf("got %v", got)
+ }
+ for i := range want {
+ if got[i] != want[i] {
+ t.Fatalf("line %d: %v, want %v", i, got[i], want[i])
+ }
+ }
+}
diff --git a/internal/runner/thin/judge.go b/internal/runner/thin/judge.go
index 8ccc9da5..b576e2e7 100644
--- a/internal/runner/thin/judge.go
+++ b/internal/runner/thin/judge.go
@@ -671,7 +671,7 @@ func (e *Engineer) review(ctx context.Context, r stepRow, progress func(wire.Ste
mu.Unlock()
return "Recorded. End with your summary.", false
}
- res := e.run(ctx, r, tree, specialistRun{action: "inspect", binding: b, tools: reviewTools, names: []string{"submit_review", "ask_person"}, permission: claude.ReadPermission, call: call, prompt: e.reviewPrompt(r, diff), keep: e.keepDir(r)})
+ res := e.run(ctx, r, tree, specialistRun{action: "inspect", binding: b, tools: reviewTools, names: []string{"submit_review", "ask_person"}, permission: claude.ReadPermission, call: call, prompt: e.reviewPrompt(r, diff), keep: e.keepDir(r), activity: e.stepActivity(r)})
rep.LogTail = res.tail
kept := e.recordKept(ctx, r, b.LocalID, res, r.CandidateSHA)
mu.Lock()
diff --git a/internal/runner/thin/link.go b/internal/runner/thin/link.go
index f8d8b399..d39dc0fe 100644
--- a/internal/runner/thin/link.go
+++ b/internal/runner/thin/link.go
@@ -51,6 +51,7 @@ type Link struct {
notify chan struct{}
pending []wire.DeltaReport
activity []wire.ActivityReport
+ stepActs []wire.StepActivityReport
waiters map[string]chan struct{}
tools map[string]chan wire.ToolResult
leaseSeq int64
@@ -106,6 +107,29 @@ func (l *Link) Activity(a wire.ActivityReport) {
l.Notify()
}
+// StepActivity queues what a running step's specialist started. Like
+// activity it is sent once, dropped while disconnected, never stored.
+func (l *Link) StepActivity(a wire.StepActivityReport) {
+ l.init()
+ l.mu.Lock()
+ if l.conn != nil && len(l.stepActs) < maxQueuedStepActivity {
+ l.stepActs = append(l.stepActs, a)
+ }
+ l.mu.Unlock()
+ l.Notify()
+}
+
+// maxQueuedStepActivity bounds the lines waiting for the next flush.
+const maxQueuedStepActivity = 64
+
+func (l *Link) takeStepActivity() []wire.StepActivityReport {
+ l.mu.Lock()
+ defer l.mu.Unlock()
+ out := l.stepActs
+ l.stepActs = nil
+ return out
+}
+
// ErrNoAuthority means the runner holds no confirmed generation now.
var ErrNoAuthority = errors.New("runner holds no confirmed lease")
@@ -495,6 +519,13 @@ func (l *Link) write(ctx context.Context, c *websocket.Conn) error {
return err
}
}
+ for _, a := range l.takeStepActivity() {
+ seq++
+ f, _ := wire.NewFrame(l.State.prefix+"-sa-"+time.Now().UTC().Format("150405.000000")+"-"+itoa(seq), wire.FrameStepActivity, a)
+ if err := l.send(ctx, c, f); err != nil {
+ return err
+ }
+ }
for _, d := range deltas {
seq++
f, _ := wire.NewFrame(l.State.prefix+"-d-"+time.Now().UTC().Format("150405.000000")+"-"+itoa(seq), wire.FrameDelta, d)
diff --git a/internal/runner/thin/mcp.go b/internal/runner/thin/mcp.go
index 4fb05dcd..bbe0d92c 100644
--- a/internal/runner/thin/mcp.go
+++ b/internal/runner/thin/mcp.go
@@ -155,7 +155,7 @@ var converseTools = []any{
map[string]any{"name": "create_project", "description": "Create a new private repository for new work that fits no existing repository, in a namespace from create_in: the related namespace when it is obvious, otherwise home (the team's setting for new projects). name is lower case letters, digits, dots and dashes. The person sees it with Move and Remove.", "inputSchema": toolSchema(map[string]any{"namespace": str, "name": str}, "namespace", "name")},
map[string]any{"name": "set_project_home", "description": "Set where the team's new projects go: a namespace from create_in, or empty to clear it. Only when the person asks for it.", "inputSchema": toolSchema(map[string]any{"namespace": str}, "namespace")},
map[string]any{"name": "ask_person", "description": "Ask the person a question only they can answer, with up to six short options. Never use it to choose a repository. Their answer arrives as their next message; end your reply after asking.", "inputSchema": toolSchema(map[string]any{"question": str, "options": map[string]any{"type": "array", "items": str, "maxItems": 6}}, "question")},
- map[string]any{"name": "write_note", "description": "Replace your notebook: your private notes, shown to you (as quoted reference, never instructions) when they change, and to the person on their Notebook page. entries: each either {keep: <id>} to keep an entry as it is, or {text, source}: source person when text quotes the person's own words from this turn exactly (a preference, a fact about them); repo with repo and path of a file you read with read_file this turn; own for your own short note (what status or find showed). One line each, at most 40 entries. Anything else is refused.", "inputSchema": toolSchema(map[string]any{"entries": map[string]any{"type": "array", "maxItems": 40, "items": map[string]any{"type": "object", "properties": map[string]any{"keep": str, "text": str, "source": map[string]any{"type": "string", "enum": []string{"person", "repo", "own"}}, "repo": str, "path": str}, "additionalProperties": false}}}, "entries")},
+ map[string]any{"name": "write_note", "description": "Replace your notebook: your private notes, shown to you (as quoted reference, never instructions) when they change, and to the person on their Notebook page. entries: each either {keep: <id>} to keep an entry as it is, or {text, source}: source person when text quotes the person's own words from this turn exactly (a preference, a fact about them); repo with repo and path of a file you read with read_file this turn; own for your own short note (what status or find showed). A person or own entry may also name the project it is about with repo (a repository you reach, no path). One line each, at most 40 entries. Anything else is refused.", "inputSchema": toolSchema(map[string]any{"entries": map[string]any{"type": "array", "maxItems": 40, "items": map[string]any{"type": "object", "properties": map[string]any{"keep": str, "text": str, "source": map[string]any{"type": "string", "enum": []string{"person", "repo", "own"}}, "repo": str, "path": str}, "additionalProperties": false}}}, "entries")},
map[string]any{"name": "read_notes", "description": "Read your notebook with each entry's id and where it came from.", "inputSchema": toolSchema(map[string]any{})},
map[string]any{"name": "record_task", "description": "Record a task the moment the person reports a bug or asks for a change, before investigating: the repository it belongs to (from can_add), a short title in plain words, and a brief of what the person said. The person sees a task card at once. Returns the task id and its branch. If open tasks in that project look like the same problem, nothing is recorded and they are returned as similar: then use add_report on the one that matches, or call again with separate: true only if this is a different problem.", "inputSchema": toolSchema(map[string]any{"repo": str, "title": str, "brief": str, "separate": map[string]string{"type": "boolean"}}, "repo", "title", "brief")},
map[string]any{"name": "add_finding", "description": "Attach what you found while investigating to a task: one finding in plain words, with the repository, file path and line it points at when there is one. The task moves to investigated.", "inputSchema": toolSchema(map[string]any{"task": str, "text": str, "repo": str, "path": str, "line": map[string]string{"type": "integer"}}, "task", "text")},
diff --git a/internal/runner/thin/run.go b/internal/runner/thin/run.go
index 25a0f171..4a0243a1 100644
--- a/internal/runner/thin/run.go
+++ b/internal/runner/thin/run.go
@@ -179,7 +179,7 @@ func Run(ctx context.Context, c runner.Config, o Options) error {
if err = engine.Start(ctx); err != nil {
return err
}
- engineer := &Engineer{O: o.Claude, Clones: clones, Forge: fg, Authorize: link.Confirm, Owners: coordinatorPersons(c)(), MaxStep: o.MaxStep, Note: o.StepNote, Healthy: health.ok, Delta: link.Delta, Activity: link.Activity, Retention: o.KeptRetention, Host: c.MachineLabel}
+ engineer := &Engineer{O: o.Claude, Clones: clones, Forge: fg, Authorize: link.Confirm, Owners: coordinatorPersons(c)(), MaxStep: o.MaxStep, Note: o.StepNote, Healthy: health.ok, Delta: link.Delta, Activity: link.Activity, StepActivity: link.StepActivity, Retention: o.KeptRetention, Host: c.MachineLabel}
link.Forget = engineer.RemoveKept
merges := &MergeWatch{State: state, Clones: clones, Git: c.GitPath, Notify: link.Notify, Logger: o.Logger, Every: o.MergeEvery}
if merges.Every <= 0 {
diff --git a/internal/thintest/client.go b/internal/thintest/client.go
index 3d44843f..a1cd0d02 100644
--- a/internal/thintest/client.go
+++ b/internal/thintest/client.go
@@ -133,6 +133,11 @@ func (c *Client) CancelTask(ctx context.Context, id string) (out wire.TaskAccept
return out, c.do(ctx, "POST", "/api/v1/tasks/"+id+"/cancel", nil, &out)
}
+// MarkDuplicate folds the task into another open task of its project.
+func (c *Client) MarkDuplicate(ctx context.Context, id, of string) (out wire.Task, err error) {
+ return out, c.do(ctx, "POST", "/api/v1/tasks/"+id+"/duplicate", wire.MarkDuplicate{Of: of}, &out)
+}
+
// RetryTask starts a new attempt once the last one's termination is known.
func (c *Client) RetryTask(ctx context.Context, id string) (out wire.TaskAccepted, err error) {
return out, c.do(ctx, "POST", "/api/v1/tasks/"+id+"/retry", nil, &out)
@@ -248,6 +253,8 @@ type Conversation struct {
Stages map[string][]string
// Activity is each turn's activity in arrival order, until its reply.
Activity map[string][]wire.Activity
+ // StepActivity is each step's activity events in arrival order.
+ StepActivity map[string][]wire.StepActivity
// FirstDelta records when each turn's first delta arrived;
// FirstActivity when its first activity line did.
FirstDelta map[string]time.Time
@@ -264,7 +271,7 @@ type Conversation struct {
}
func NewConversation(s wire.Snapshot) *Conversation {
- c := &Conversation{Messages: map[string]wire.Message{}, Turns: map[string]wire.Turn{}, Drafts: map[string]string{}, FirstDelta: map[string]time.Time{}, FirstActivity: map[string]time.Time{}, Activity: map[string][]wire.Activity{}, changed: make(chan struct{})}
+ c := &Conversation{Messages: map[string]wire.Message{}, Turns: map[string]wire.Turn{}, Drafts: map[string]string{}, FirstDelta: map[string]time.Time{}, FirstActivity: map[string]time.Time{}, Activity: map[string][]wire.Activity{}, StepActivity: map[string][]wire.StepActivity{}, changed: make(chan struct{})}
c.Reset(s)
return c
}
@@ -414,7 +421,13 @@ func (c *Conversation) Apply(e wire.Event) bool {
}
case wire.EventActivity:
var a wire.Activity
- if json.Unmarshal(e.Data, &a) == nil {
+ if e.Resource == wire.ResourceStep {
+ var sa wire.StepActivity
+ if wire.Strict(e.Data, &sa) == nil {
+ c.StepActivity[sa.StepID] = append(c.StepActivity[sa.StepID], sa)
+ applied = true
+ }
+ } else if json.Unmarshal(e.Data, &a) == nil {
if _, ok := c.FirstActivity[a.TurnID]; !ok {
c.FirstActivity[a.TurnID] = time.Now()
}
diff --git a/internal/thintest/inner_contract_test.go b/internal/thintest/inner_contract_test.go
new file mode 100644
index 00000000..cfe06ffa
--- /dev/null
+++ b/internal/thintest/inner_contract_test.go
@@ -0,0 +1,246 @@
+package thintest
+
+import (
+ "net/http"
+ "strings"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/equipo/internal/equipo"
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// activity sends one step activity line (not durable: no ack).
+func (r *toolRig) activity(id string, a wire.StepActivityReport) {
+ r.t.Helper()
+ if err := r.runner.Send(r.ctx, id, wire.FrameStepActivity, a); err != nil {
+ r.t.Fatal(err)
+ }
+}
+
+// TestContractStepActivity: a running step's activity lines come only
+// from the step person's primary runner, for the current attempt; the
+// newest five are kept on the step and every member gets each line as
+// an activity event; a new attempt starts with none.
+func TestContractStepActivity(t *testing.T) {
+ a := newToolRig(t)
+ ctx := a.ctx
+ b := personToolRig(t, a, "second@example.com", equipo.RoleOwner)
+ id := taskID(t, a.call("k1", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Swipe back from the edge does nothing", "brief": "x"}))
+ a.call("k2", wire.ToolStartTask, map[string]string{"task": id, "brief": "go"})
+ _, body := a.expect(wire.FrameDispatch)
+ d := body.(*wire.DispatchCommand)
+ a.step("r-s1", wire.StepReport{TaskID: id, StepID: d.StepID, Attempt: 1, State: wire.StepRunning, BaseSHA: strings.Repeat("1", 40)})
+
+ // Another person's runner, about A's step: dropped. B's own turn
+ // activity after it shows B's frame was applied first.
+ if err := b.runner.Send(ctx, "b-act", wire.FrameStepActivity, wire.StepActivityReport{TaskID: id, StepID: d.StepID, Attempt: 1, Kind: wire.ActivityRead, Subject: "secret.go"}); err != nil {
+ t.Fatal(err)
+ }
+ if err := b.runner.Send(ctx, "b-turn", wire.FrameActivity, wire.ActivityReport{TurnID: b.turn, Attempt: 1, Kind: wire.ActivityThink}); err != nil {
+ t.Fatal(err)
+ }
+ b.wait("B turn activity", func(c *Conversation) bool { return len(c.Activity[b.turn]) > 0 })
+ // A stale attempt: dropped.
+ a.activity("a-stale", wire.StepActivityReport{TaskID: id, StepID: d.StepID, Attempt: 2, Kind: wire.ActivityRead, Subject: "stale.go"})
+ lines := []wire.StepActivityReport{
+ {Kind: wire.ActivityRead, Subject: "/workspace/panes/swipe.go"},
+ {Kind: wire.ActivitySearch, Subject: "EdgeSwipe"},
+ {Kind: "launch_missiles", Subject: "x"},
+ {Kind: wire.ActivityEdit, Subject: "panes/swipe.go"},
+ {Kind: wire.ActivityRun, Subject: "go test ./panes\nrm -rf /"},
+ {Kind: wire.ActivityRun, Subject: "make \x1b[31mci" + strings.Repeat("x", 300)},
+ {Kind: wire.ActivityEdit, Subject: "panes/swipe_test.go"},
+ }
+ for i, l := range lines {
+ l.TaskID, l.StepID, l.Attempt = id, d.StepID, 1
+ a.activity("a-act-"+itoa(i), l)
+ }
+ for _, r := range []*toolRig{a, b} {
+ r.wait("every line, to every member", func(c *Conversation) bool { return len(c.StepActivity[d.StepID]) == len(lines) })
+ }
+ var got []wire.StepActivity
+ a.conv.Locked(func(c *Conversation) { got = c.StepActivity[d.StepID] })
+ first, last := got[0].Activity, got[len(got)-1].Activity
+ if len(first) != 1 || first[0].Kind != wire.ActivityRead || first[0].Subject != "panes/swipe.go" || first[0].At.IsZero() || got[0].TaskID != id || got[0].Attempt != 1 {
+ t.Fatalf("first line %+v", got[0])
+ }
+ if len(last) != wire.MaxStepActivity || last[0].Kind != wire.ActivityOther || last[2].Subject != "go test ./panes" || strings.ContainsRune(last[3].Subject, 0x1b) || len(last[3].Subject) > wire.MaxActivitySubject || last[4].Subject != "panes/swipe_test.go" {
+ t.Fatalf("kept lines %+v", last)
+ }
+ for _, e := range got {
+ for _, l := range e.Activity {
+ if l.Subject == "secret.go" || l.Subject == "stale.go" {
+ t.Fatalf("a dropped line was kept: %+v", e)
+ }
+ }
+ }
+ k, err := a.client.Task(ctx, id)
+ if err != nil || len(k.Steps[0].Activity) != wire.MaxStepActivity || k.Steps[0].Activity[4].Subject != "panes/swipe_test.go" {
+ t.Fatalf("step activity on the task: %+v %v", k.Steps, err)
+ }
+ // The step keeps its last lines after it ends; a retry starts afresh.
+ a.step("r-s2", wire.StepReport{TaskID: id, StepID: d.StepID, Attempt: 1, State: wire.StepFailed, Reason: "runner_restarted", Termination: true})
+ if k, _ := a.client.Task(ctx, id); len(k.Steps[0].Activity) != wire.MaxStepActivity {
+ t.Fatalf("ended step lost its lines: %+v", k.Steps[0])
+ }
+ a.activity("a-after", wire.StepActivityReport{TaskID: id, StepID: d.StepID, Attempt: 1, Kind: wire.ActivityRead, Subject: "late.go"})
+ if _, err := a.client.RetryTask(ctx, id); err != nil {
+ t.Fatal(err)
+ }
+ a.expect(wire.FrameDispatch)
+ k, _ = a.client.Task(ctx, id)
+ if len(k.Steps[0].Activity) != 0 || k.Steps[0].Attempt != 2 {
+ t.Fatalf("retry kept the old activity: %+v", k.Steps[0])
+ }
+}
+
+// TestContractTaskSourceAndDuplicates: a task names its creator, the
+// message it was noted from and the coordinator looking into it; a task
+// recorded anyway beside a similar open one names it as a possible
+// duplicate, and only its creator may fold it into that one.
+func TestContractTaskSourceAndDuplicates(t *testing.T) {
+ a := newToolRig(t)
+ ctx := a.ctx
+ b := personToolRig(t, a, "second@example.com", equipo.RoleOwner)
+ first := taskID(t, a.call("k1", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Swipe back from the edge does nothing", "brief": "On iOS, swiping from the left edge does not go back."}))
+ var source wire.Message
+ a.conv.Locked(func(c *Conversation) {
+ for _, m := range c.Messages {
+ if m.Role == wire.RolePerson && m.TurnID == a.turn {
+ source = m
+ }
+ }
+ })
+ k, err := a.client.Task(ctx, first)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if k.CreatorName != "Owner" || source.ID == "" || k.SourceMessageID != source.ID || k.SourceAt == nil || !k.SourceAt.Equal(source.CreatedAt) {
+ t.Fatalf("creator and source: %q %q %v, message %+v", k.CreatorName, k.SourceMessageID, k.SourceAt, source)
+ }
+ if k.Coordinator == nil || k.Coordinator.Kind != wire.CoordinatorLooking || k.Coordinator.Since.IsZero() || k.DuplicateOf != nil {
+ t.Fatalf("coordinator looking: %+v dup %+v", k.Coordinator, k.DuplicateOf)
+ }
+
+ similar := map[string]any{"repo": "oficina/sample", "title": "Swipe from the edge to go back does nothing", "brief": "Swiping from the left edge does not go back on iOS."}
+ if res := a.call("k2", wire.ToolRecordTask, similar); res.Code == "recorded" {
+ t.Fatalf("a similar task was recorded: %+v", res)
+ }
+ similar["separate"] = true
+ second := taskID(t, a.call("k3", wire.ToolRecordTask, similar))
+ k, _ = a.client.Task(ctx, second)
+ if k.DuplicateOf == nil || k.DuplicateOf.ID != first || k.DuplicateOf.Title != "Swipe back from the edge does nothing" || k.DuplicateOf.Stage != wire.StageNoted {
+ t.Fatalf("duplicate_of: %+v", k.DuplicateOf)
+ }
+ other := taskID(t, a.call("k4", wire.ToolRecordTask, map[string]string{"repo": "oficina/equipo", "title": "Rename the coordinator", "brief": "y"}))
+
+ // Only the creator folds a task, into another open task of its project.
+ if _, err := b.client.MarkDuplicate(ctx, second, first); Status(err) != http.StatusForbidden {
+ t.Fatalf("another person folded it: %v", err)
+ }
+ for of, want := range map[string]int{second: 422, "": 422, other: 422, "tknope": 404} {
+ if _, err := a.client.MarkDuplicate(ctx, second, of); Status(err) != want {
+ t.Fatalf("fold into %q: %v, want %d", of, err, want)
+ }
+ }
+ folded, err := a.client.MarkDuplicate(ctx, second, first)
+ if err != nil || folded.Stage != wire.StageCancelled || folded.DuplicateOf == nil || folded.DuplicateOf.ID != first {
+ t.Fatalf("fold: %+v %v", folded, err)
+ }
+ k, _ = a.client.Task(ctx, first)
+ if len(k.Thread) != 1 || k.Thread[0].Author != Owner || !strings.Contains(k.Thread[0].Text, "Swipe from the edge to go back does nothing") || !strings.Contains(k.Thread[0].Text, "on iOS.") || k.Reports != 1 {
+ t.Fatalf("report on the kept task: %+v reports %d", k.Thread, k.Reports)
+ }
+ if _, err := a.client.MarkDuplicate(ctx, second, first); Status(err) != http.StatusConflict {
+ t.Fatalf("fold an ended task: %v", err)
+ }
+ b.wait("B sees the fold", func(c *Conversation) bool { return c.Tasks[second].Stage == wire.StageCancelled })
+}
+
+// TestContractCoordinatorMerging: while Equipo merges a task, the task
+// says the coordinator is merging it, since the merge step started.
+func TestContractCoordinatorMerging(t *testing.T) {
+ r := newToolRig(t)
+ base, cand := strings.Repeat("1", 40), strings.Repeat("2", 40)
+ id := r.judgedTask("a", "Fix the README typo", base, cand, wire.ChecksPassed, "")
+ _, body := r.expect(wire.FrameDispatch)
+ m := body.(*wire.DispatchCommand)
+ r.step("mg-run", wire.StepReport{TaskID: id, StepID: m.StepID, Attempt: 1, State: wire.StepRunning, BaseSHA: base, CandidateSHA: cand})
+ k, _ := r.client.Task(r.ctx, id)
+ started := k.Steps[len(k.Steps)-1].StartedAt
+ if k.Stage != wire.StageMerging || k.Coordinator == nil || k.Coordinator.Kind != wire.CoordinatorMerging || started == nil || !k.Coordinator.Since.Equal(*started) {
+ t.Fatalf("merging: %s %+v started %v steps %d", k.Stage, k.Coordinator, started, len(k.Steps))
+ }
+ r.mergedStep("mg-m", m, strings.Repeat("e", 40))
+ r.wait("done", func(c *Conversation) bool { return c.Tasks[id].Stage == wire.StageDone })
+ if k, _ := r.client.Task(r.ctx, id); k.Coordinator != nil {
+ t.Fatalf("done task still busy: %+v", k.Coordinator)
+ }
+}
+
+// TestContractProjectFacts: a project says what the runners' index knows
+// of it (description, stack, whether checks run, the default branch's
+// newest commit) and who is involved; a repository no index knows has no
+// facts, never invented ones.
+func TestContractProjectFacts(t *testing.T) {
+ a := newToolRig(t)
+ ctx := a.ctx
+ head := time.Date(2026, 11, 7, 9, 30, 0, 0, time.UTC)
+ hello := wire.Hello{Generation: a.runner.Welcome.Generation, Repos: []string{"amadan.net/oficina/sample", "amadan.net/oficina/equipo"}, CreateIn: []string{"oficina"}, Agent: "equipo-test", Catalog: []wire.RepoInfo{{Repo: "amadan.net/oficina/sample", DefaultBranch: "main", Summary: "Woodstar is a reading app.", Names: []string{"sample", "Woodstar"}, Hints: []string{"swift", "swiftui", "unknown"}, UpdatedAt: head, HeadSHA: strings.Repeat("3", 40), HeadSubject: "Trim the compose sheet", ChecksReason: "needs_macos"}}, Accounts: []wire.Account{{ID: "claude-a", Provider: "claude", Email: Owner, Healthy: true}}, Versions: map[string]string{"runner": "test", "claude": "2.1.312"}}
+ if err := a.runner.Send(ctx, "h2", wire.FrameHello, hello); err != nil {
+ t.Fatal(err)
+ }
+ b := personToolRig(t, a, "nora.k@example.com", equipo.RoleOwner)
+ taskID(t, a.call("k1", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Timeline jumps", "brief": "x"}))
+ taskID(t, b.call("k2", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Images load late", "brief": "y"}))
+ taskID(t, a.call("k3", wire.ToolRecordTask, map[string]string{"repo": "oficina/equipo", "title": "Rename the coordinator", "brief": "z"}))
+ list, err := a.client.Projects(ctx)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var sample, equipoP wire.Project
+ for _, p := range list.Items {
+ switch p.Repo {
+ case "amadan.net/oficina/sample":
+ sample = p
+ case "amadan.net/oficina/equipo":
+ equipoP = p
+ }
+ }
+ if sample.Description != "Woodstar is a reading app." || strings.Join(sample.Stack, ",") != "Swift,SwiftUI" || sample.Checks == nil || sample.Checks.Here || sample.Checks.Reason != "needs_macos" {
+ t.Fatalf("sample facts: %+v %+v", sample, sample.Checks)
+ }
+ at := sample.Attachments[0]
+ if at.DefaultBranch != "main" || at.HeadSHA != strings.Repeat("3", 40) || at.HeadSubject != "Trim the compose sheet" || at.HeadAt == nil || !at.HeadAt.Equal(head) {
+ t.Fatalf("attachment head: %+v", at)
+ }
+ if len(sample.People) != 2 || sample.People[0].Address != Owner || sample.People[0].Name != "Owner" || sample.People[1].Name != "Nora" || sample.People[1].Initials != "N" {
+ t.Fatalf("people: %+v", sample.People)
+ }
+ if equipoP.Checks != nil || equipoP.Description != "" || len(equipoP.Stack) != 0 || equipoP.Attachments[0].HeadSHA != "" {
+ t.Fatalf("invented facts: %+v", equipoP)
+ }
+ // A gate this runner can run: checks run here.
+ hello.Catalog[0].ChecksReason, hello.Catalog[0].Gate, hello.Catalog[0].Hints = "", "make ci", []string{"go"}
+ if err := a.runner.Send(ctx, "h3", wire.FrameHello, hello); err != nil {
+ t.Fatal(err)
+ }
+ deadline := time.Now().Add(5 * time.Second)
+ for {
+ list, _ = a.client.Projects(ctx)
+ var c *wire.ProjectChecks
+ for _, p := range list.Items {
+ if p.Repo == "amadan.net/oficina/sample" {
+ c = p.Checks
+ }
+ }
+ if c != nil && c.Here && c.Gate == "make ci" && c.Reason == "" {
+ break
+ }
+ if time.Now().After(deadline) {
+ t.Fatalf("checks here: %+v", c)
+ }
+ time.Sleep(20 * time.Millisecond)
+ }
+}
diff --git a/internal/wire/tasks_test.go b/internal/wire/tasks_test.go
index 74ee1f23..90fd9714 100644
--- a/internal/wire/tasks_test.go
+++ b/internal/wire/tasks_test.go
@@ -86,3 +86,11 @@ func TestAddressesReview(t *testing.T) {
}
}
}
+
+// Step activity lines are not durable: a lost line is only a lost line,
+// and the step's report carries what matters.
+func TestStepActivityIsNotDurable(t *testing.T) {
+ if (wire.Frame{Type: wire.FrameStepActivity}).Durable() {
+ t.Fatal("step_activity is durable")
+ }
+}
diff --git a/internal/wire/wire_test.go b/internal/wire/wire_test.go
index 87f6c8a4..490608c4 100644
--- a/internal/wire/wire_test.go
+++ b/internal/wire/wire_test.go
@@ -33,7 +33,7 @@ func TestFrameFixturesRoundTrip(t *testing.T) {
t.Fatalf("%s: round trip\n got %s\nwant %s", name, out, raw)
}
}
- for _, kind := range []string{wire.FrameWelcome, wire.FrameMessage, wire.FrameCancel, wire.FrameDrain, wire.FrameAck, wire.FrameHello, wire.FrameSync, wire.FrameDelta, wire.FrameReply, wire.FrameTurn, wire.FrameLease, wire.FrameToolCall, wire.FrameToolResult, wire.FrameActivity, wire.FrameMoveIn, wire.FrameNotebook, wire.FrameReset, wire.FrameDispatch, wire.FrameCancelStep, wire.FrameStep, wire.FrameRecheck, wire.FrameWatchMerge, wire.FrameMerged, wire.FrameAsk, wire.FrameCancelAsk, wire.FrameAnswer, wire.FrameForgetTask, wire.FrameBranch} {
+ for _, kind := range []string{wire.FrameWelcome, wire.FrameMessage, wire.FrameCancel, wire.FrameDrain, wire.FrameAck, wire.FrameHello, wire.FrameSync, wire.FrameDelta, wire.FrameReply, wire.FrameTurn, wire.FrameLease, wire.FrameToolCall, wire.FrameToolResult, wire.FrameActivity, wire.FrameMoveIn, wire.FrameNotebook, wire.FrameReset, wire.FrameDispatch, wire.FrameCancelStep, wire.FrameStep, wire.FrameRecheck, wire.FrameWatchMerge, wire.FrameMerged, wire.FrameAsk, wire.FrameCancelAsk, wire.FrameAnswer, wire.FrameForgetTask, wire.FrameBranch, wire.FrameStepActivity} {
if !seen[kind] {
t.Fatalf("no fixture for frame %s", kind)
}
diff --git a/internal/wire/wiretest/fixtures.go b/internal/wire/wiretest/fixtures.go
index 1b648082..26d31292 100644
--- a/internal/wire/wiretest/fixtures.go
+++ b/internal/wire/wiretest/fixtures.go
@@ -55,7 +55,7 @@ func APIType(name string) any {
return &wire.CancelAccepted{}
case "error-conflict.json":
return &wire.Error{}
- case "event-delta.json", "event-turn.json", "event-runner.json", "event-card.json", "event-project.json", "event-activity.json", "event-coordinator.json", "event-task.json", "event-step.json", "event-question.json":
+ case "event-delta.json", "event-turn.json", "event-runner.json", "event-card.json", "event-project.json", "event-activity.json", "event-coordinator.json", "event-task.json", "event-step.json", "event-question.json", "event-step-activity.json":
return &wire.Event{}
case "project.json":
return &wire.Project{}
@@ -89,6 +89,8 @@ func APIType(name string) any {
return &wire.Question{}
case "ask-request.json":
return &wire.AskQuestion{}
+ case "duplicate-request.json":
+ return &wire.MarkDuplicate{}
}
return nil
}
diff --git a/internal/wire/wiretest/testdata/api/duplicate-request.json b/internal/wire/wiretest/testdata/api/duplicate-request.json
new file mode 100644
index 00000000..af824a8a
--- /dev/null
+++ b/internal/wire/wiretest/testdata/api/duplicate-request.json
@@ -0,0 +1 @@
+{"of":"tk0000"}
diff --git a/internal/wire/wiretest/testdata/api/event-project.json b/internal/wire/wiretest/testdata/api/event-project.json
index b4c5ec8a..9482a85a 100644
--- a/internal/wire/wiretest/testdata/api/event-project.json
+++ b/internal/wire/wiretest/testdata/api/event-project.json
@@ -1 +1 @@
-{"cursor":43,"type":"project","resource":"project","id":"p_0001","revision":1,"data":{"id":"p_0001","revision":1,"repo":"amadan.net/oficina/sample","name":"oficina/sample","title":"Sample","attachments":[{"kind":"repo","ref":"amadan.net/oficina/sample","name":"oficina/sample"}],"state":"active","added_by":"owner@example.com","created_at":"2026-11-06T10:00:00Z","updated_at":"2026-11-06T10:00:00Z"}}
+{"cursor":43,"type":"project","resource":"project","id":"p_0001","revision":1,"data":{"id":"p_0001","revision":1,"repo":"amadan.net/oficina/sample","name":"oficina/sample","title":"Sample","attachments":[{"kind":"repo","ref":"amadan.net/oficina/sample","name":"oficina/sample","default_branch":"main","head_sha":"3333333333333333333333333333333333333333","head_subject":"Swipe from the edge goes back","head_at":"2026-11-07T09:30:00Z"}],"state":"active","added_by":"owner@example.com","created_at":"2026-11-06T10:00:00Z","updated_at":"2026-11-06T10:00:00Z","description":"A sample app for Equipo tests.","stack":["Go"],"checks":null,"people":[{"address":"owner@example.com","name":"Owner","initials":"O"}]}}
diff --git a/internal/wire/wiretest/testdata/api/event-step-activity.json b/internal/wire/wiretest/testdata/api/event-step-activity.json
new file mode 100644
index 00000000..3d38d76f
--- /dev/null
+++ b/internal/wire/wiretest/testdata/api/event-step-activity.json
@@ -0,0 +1 @@
+{"cursor":44,"type":"activity","resource":"step","id":"s_0001","revision":0,"attempt":1,"data":{"task_id":"tk0001","step_id":"s_0001","attempt":1,"activity":[{"kind":"read","subject":"panes/swipe.go","at":"2026-11-07T10:00:20Z"},{"kind":"edit","subject":"panes/swipe.go","at":"2026-11-07T10:01:02Z"}]}}
diff --git a/internal/wire/wiretest/testdata/api/event-step.json b/internal/wire/wiretest/testdata/api/event-step.json
index d31c40b8..bb879f51 100644
--- a/internal/wire/wiretest/testdata/api/event-step.json
+++ b/internal/wire/wiretest/testdata/api/event-step.json
@@ -1 +1 @@
-{"cursor":43,"type":"step","resource":"step","id":"s_0001","revision":3,"attempt":1,"data":{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true}}
+{"cursor":43,"type":"step","resource":"step","id":"s_0001","revision":3,"attempt":1,"data":{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"activity":[{"kind":"read","subject":"panes/swipe.go","at":"2026-11-07T10:00:20Z"},{"kind":"edit","subject":"panes/swipe.go","at":"2026-11-07T10:01:02Z"},{"kind":"run","subject":"go test ./panes","at":"2026-11-07T10:01:20Z"}]}}
diff --git a/internal/wire/wiretest/testdata/api/event-task.json b/internal/wire/wiretest/testdata/api/event-task.json
index 0b559c5a..4eee3bd1 100644
--- a/internal/wire/wiretest/testdata/api/event-task.json
+++ b/internal/wire/wiretest/testdata/api/event-task.json
@@ -1 +1 @@
-{"cursor":42,"type":"task","resource":"task","id":"tk0001","revision":5,"data":{"id":"tk0001","revision":5,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"in_progress","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:01:40Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"","checks_reason":"","verdict":"","review_label":"","needs_you":"","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}]}}
+{"cursor":42,"type":"task","resource":"task","id":"tk0001","revision":5,"data":{"id":"tk0001","revision":5,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"in_progress","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"activity":[{"kind":"read","subject":"panes/swipe.go","at":"2026-11-07T10:00:20Z"},{"kind":"edit","subject":"panes/swipe.go","at":"2026-11-07T10:01:02Z"},{"kind":"run","subject":"go test ./panes","at":"2026-11-07T10:01:20Z"}]}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:01:40Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"","checks_reason":"","verdict":"","review_label":"","needs_you":"","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":null,"reports":0,"creator_name":"Owner","source_message_id":"m_0001","source_at":"2026-11-07T09:59:58Z","duplicate_of":{"id":"tk0000","title":"Edge swipe does not go back","stage":"ready_to_merge"},"coordinator":null}}
diff --git a/internal/wire/wiretest/testdata/api/needs-you.json b/internal/wire/wiretest/testdata/api/needs-you.json
index 8f299580..7526edf9 100644
--- a/internal/wire/wiretest/testdata/api/needs-you.json
+++ b/internal/wire/wiretest/testdata/api/needs-you.json
@@ -1 +1 @@
-{"items":[{"id":"tk0001","revision":9,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"ready_to_merge","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false},{"id":"s_0002","revision":2,"task_id":"tk0001","index":2,"specialist":"checks","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","log_tail":"ok \tamadan.net/oficina/sample/panes\t0.012s","started_at":"2026-11-07T10:01:45Z","finished_at":"2026-11-07T10:02:30Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"passed","gate":"make ci","exit_code":0,"askable":false,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false},{"id":"s_0003","revision":2,"task_id":"tk0001","index":3,"specialist":"review","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"The change makes EdgeSwipe go back and keeps the pane order. Approved.","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"claude","account":"claude-a","verdict":"approve","review_label":"same_family","findings":[{"id":"rf_0001","text":"Consider a test for a swipe that starts mid-screen.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:04:10Z"}],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:04:10Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"passed","checks_reason":"","verdict":"approve","review_label":"same_family","needs_you":"merge","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":null,"reports":0}]}
+{"items":[{"id":"tk0001","revision":9,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"ready_to_merge","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"activity":[{"kind":"read","subject":"panes/swipe.go","at":"2026-11-07T10:00:20Z"},{"kind":"edit","subject":"panes/swipe.go","at":"2026-11-07T10:01:02Z"},{"kind":"run","subject":"go test ./panes","at":"2026-11-07T10:01:20Z"}]},{"id":"s_0002","revision":2,"task_id":"tk0001","index":2,"specialist":"checks","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","log_tail":"ok \tamadan.net/oficina/sample/panes\t0.012s","started_at":"2026-11-07T10:01:45Z","finished_at":"2026-11-07T10:02:30Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"passed","gate":"make ci","exit_code":0,"askable":false,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"activity":[]},{"id":"s_0003","revision":2,"task_id":"tk0001","index":3,"specialist":"review","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"The change makes EdgeSwipe go back and keeps the pane order. Approved.","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"claude","account":"claude-a","verdict":"approve","review_label":"same_family","findings":[{"id":"rf_0001","text":"Consider a test for a swipe that starts mid-screen.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:04:10Z"}],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"activity":[]}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:04:10Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"passed","checks_reason":"","verdict":"approve","review_label":"same_family","needs_you":"merge","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":null,"reports":0,"creator_name":"Owner","source_message_id":"m_0001","source_at":"2026-11-07T09:59:58Z","duplicate_of":null,"coordinator":null}]}
diff --git a/internal/wire/wiretest/testdata/api/project.json b/internal/wire/wiretest/testdata/api/project.json
index 99a080de..3208c317 100644
--- a/internal/wire/wiretest/testdata/api/project.json
+++ b/internal/wire/wiretest/testdata/api/project.json
@@ -1 +1 @@
-{"id":"p_0001","revision":1,"repo":"amadan.net/oficina/sample","name":"oficina/sample","title":"Sample","attachments":[{"kind":"repo","ref":"amadan.net/oficina/sample","name":"oficina/sample"}],"state":"active","added_by":"owner@example.com","created_at":"2026-11-06T10:00:00Z","updated_at":"2026-11-06T10:00:01Z"}
+{"id":"p_0001","revision":1,"repo":"amadan.net/oficina/sample","name":"oficina/sample","title":"Sample","attachments":[{"kind":"repo","ref":"amadan.net/oficina/sample","name":"oficina/sample","default_branch":"main","head_sha":"3333333333333333333333333333333333333333","head_subject":"Swipe from the edge goes back","head_at":"2026-11-07T09:30:00Z"}],"state":"active","added_by":"owner@example.com","created_at":"2026-11-06T10:00:00Z","updated_at":"2026-11-06T10:00:01Z","description":"A sample app for Equipo tests.","stack":["Go"],"checks":null,"people":[{"address":"owner@example.com","name":"Owner","initials":"O"}]}
diff --git a/internal/wire/wiretest/testdata/api/projects.json b/internal/wire/wiretest/testdata/api/projects.json
index 72f93ffd..a311027c 100644
--- a/internal/wire/wiretest/testdata/api/projects.json
+++ b/internal/wire/wiretest/testdata/api/projects.json
@@ -1 +1 @@
-{"items":[{"id":"p_0001","revision":1,"repo":"amadan.net/oficina/sample","name":"oficina/sample","title":"Sample","attachments":[{"kind":"repo","ref":"amadan.net/oficina/sample","name":"oficina/sample"}],"state":"active","added_by":"owner@example.com","created_at":"2026-11-06T10:00:00Z","updated_at":"2026-11-06T10:00:01Z"}],"allowed":["amadan.net/oficina/equipo","amadan.net/oficina/sample"],"home":"oficina"}
+{"items":[{"id":"p_0001","revision":1,"repo":"amadan.net/oficina/sample","name":"oficina/sample","title":"Sample","attachments":[{"kind":"repo","ref":"amadan.net/oficina/sample","name":"oficina/sample","default_branch":"main","head_sha":"3333333333333333333333333333333333333333","head_subject":"Swipe from the edge goes back","head_at":"2026-11-07T09:30:00Z"}],"state":"active","added_by":"owner@example.com","created_at":"2026-11-06T10:00:00Z","updated_at":"2026-11-06T10:00:01Z","description":"A sample app for Equipo tests.","stack":["Go"],"checks":{"here":true,"gate":"make ci","reason":""},"people":[{"address":"owner@example.com","name":"Owner","initials":"O"}]}],"allowed":["amadan.net/oficina/equipo","amadan.net/oficina/sample"],"home":"oficina"}
diff --git a/internal/wire/wiretest/testdata/api/snapshot.json b/internal/wire/wiretest/testdata/api/snapshot.json
index 1b69337d..22d99ed7 100644
--- a/internal/wire/wiretest/testdata/api/snapshot.json
+++ b/internal/wire/wiretest/testdata/api/snapshot.json
@@ -1 +1 @@
-{"me":{"id":"owner@example.com","address":"owner@example.com","role":"owner","person":{"address":"owner@example.com","display_identity":"owner@example.com","active":true,"role":"owner"},"team_id":"TEAM1","team_name":"Example","revision":1},"messages":[{"id":"m_0001","revision":1,"role":"person","text":"hello","turn_id":"t_0001","created_at":"2026-11-06T10:00:00Z"}],"turns":[{"id":"t_0001","revision":2,"kind":"","state":"running","reason":"","attempt":1,"message_ids":["m_0001"],"reply_id":"","created_at":"2026-11-06T10:00:00Z","updated_at":"2026-11-06T10:00:01Z","timing":null}],"runner":{"id":"RUNNER1","revision":3,"online":true},"projects":[{"id":"p_0001","revision":1,"repo":"amadan.net/oficina/sample","name":"oficina/sample","title":"Sample","attachments":[{"kind":"repo","ref":"amadan.net/oficina/sample","name":"oficina/sample"}],"state":"active","added_by":"owner@example.com","created_at":"2026-11-06T10:00:00Z","updated_at":"2026-11-06T10:00:00Z"}],"cards":[{"id":"c_0001","revision":1,"kind":"project","state":"added","turn_id":"t_0001","project_id":"p_0001","name":"oficina/sample","question":"","options":[],"choice":"","task_id":"","created_at":"2026-11-06T10:00:00Z","updated_at":"2026-11-06T10:00:00Z"}],"tasks":[],"coordinator":{"id":"owner@example.com","revision":2,"state":"ready","turn_id":"","moved_in_at":"2026-11-06T09:59:00Z"},"cursor":40}
+{"me":{"id":"owner@example.com","address":"owner@example.com","role":"owner","person":{"address":"owner@example.com","display_identity":"owner@example.com","active":true,"role":"owner"},"team_id":"TEAM1","team_name":"Example","revision":1},"messages":[{"id":"m_0001","revision":1,"role":"person","text":"hello","turn_id":"t_0001","created_at":"2026-11-06T10:00:00Z"}],"turns":[{"id":"t_0001","revision":2,"kind":"","state":"running","reason":"","attempt":1,"message_ids":["m_0001"],"reply_id":"","created_at":"2026-11-06T10:00:00Z","updated_at":"2026-11-06T10:00:01Z","timing":null}],"runner":{"id":"RUNNER1","revision":3,"online":true},"projects":[{"id":"p_0001","revision":1,"repo":"amadan.net/oficina/sample","name":"oficina/sample","title":"Sample","attachments":[{"kind":"repo","ref":"amadan.net/oficina/sample","name":"oficina/sample","default_branch":"main","head_sha":"3333333333333333333333333333333333333333","head_subject":"Swipe from the edge goes back","head_at":"2026-11-07T09:30:00Z"}],"state":"active","added_by":"owner@example.com","created_at":"2026-11-06T10:00:00Z","updated_at":"2026-11-06T10:00:00Z","description":"A sample app for Equipo tests.","stack":["Go"],"checks":{"here":true,"gate":"make ci","reason":""},"people":[{"address":"owner@example.com","name":"Owner","initials":"O"}]}],"cards":[{"id":"c_0001","revision":1,"kind":"project","state":"added","turn_id":"t_0001","project_id":"p_0001","name":"oficina/sample","question":"","options":[],"choice":"","task_id":"","created_at":"2026-11-06T10:00:00Z","updated_at":"2026-11-06T10:00:00Z"}],"tasks":[],"coordinator":{"id":"owner@example.com","revision":2,"state":"ready","turn_id":"","moved_in_at":"2026-11-06T09:59:00Z"},"cursor":40}
diff --git a/internal/wire/wiretest/testdata/api/task-merged.json b/internal/wire/wiretest/testdata/api/task-merged.json
index 6d25f4f1..168216d8 100644
--- a/internal/wire/wiretest/testdata/api/task-merged.json
+++ b/internal/wire/wiretest/testdata/api/task-merged.json
@@ -1 +1 @@
-{"id":"tk0001","revision":9,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"done","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false},{"id":"s_0002","revision":2,"task_id":"tk0001","index":2,"specialist":"checks","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","log_tail":"ok \tamadan.net/oficina/sample/panes\t0.012s","started_at":"2026-11-07T10:01:45Z","finished_at":"2026-11-07T10:02:30Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"passed","gate":"make ci","exit_code":0,"askable":false,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false},{"id":"s_0003","revision":2,"task_id":"tk0001","index":3,"specialist":"review","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"The change makes EdgeSwipe go back and keeps the pane order. Approved.","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"claude","account":"claude-a","verdict":"approve","review_label":"same_family","findings":[{"id":"rf_0001","text":"Consider a test for a swipe that starts mid-screen.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:04:10Z"}],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false},{"id":"s_0009","revision":2,"task_id":"tk0001","index":4,"specialist":"merge","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","into":"main","strategy":"merge","without_checks":false}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:04:10Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"passed","checks_reason":"","verdict":"approve","review_label":"same_family","needs_you":"","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":{"sha":"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","into":"main","strategy":"merge","without_checks":false,"at":"2026-11-07T12:00:00Z"},"reports":0}
+{"id":"tk0001","revision":9,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"done","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"activity":[{"kind":"read","subject":"panes/swipe.go","at":"2026-11-07T10:00:20Z"},{"kind":"edit","subject":"panes/swipe.go","at":"2026-11-07T10:01:02Z"},{"kind":"run","subject":"go test ./panes","at":"2026-11-07T10:01:20Z"}]},{"id":"s_0002","revision":2,"task_id":"tk0001","index":2,"specialist":"checks","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","log_tail":"ok \tamadan.net/oficina/sample/panes\t0.012s","started_at":"2026-11-07T10:01:45Z","finished_at":"2026-11-07T10:02:30Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"passed","gate":"make ci","exit_code":0,"askable":false,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"activity":[]},{"id":"s_0003","revision":2,"task_id":"tk0001","index":3,"specialist":"review","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"The change makes EdgeSwipe go back and keeps the pane order. Approved.","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"claude","account":"claude-a","verdict":"approve","review_label":"same_family","findings":[{"id":"rf_0001","text":"Consider a test for a swipe that starts mid-screen.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:04:10Z"}],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"activity":[]},{"id":"s_0009","revision":2,"task_id":"tk0001","index":4,"specialist":"merge","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","into":"main","strategy":"merge","without_checks":false,"activity":[]}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:04:10Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"passed","checks_reason":"","verdict":"approve","review_label":"same_family","needs_you":"","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":{"sha":"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","into":"main","strategy":"merge","without_checks":false,"at":"2026-11-07T12:00:00Z"},"reports":0,"creator_name":"Owner","source_message_id":"m_0001","source_at":"2026-11-07T09:59:58Z","duplicate_of":null,"coordinator":null}
diff --git a/internal/wire/wiretest/testdata/api/task-ready.json b/internal/wire/wiretest/testdata/api/task-ready.json
index 32fd7fa3..6e5ea2a8 100644
--- a/internal/wire/wiretest/testdata/api/task-ready.json
+++ b/internal/wire/wiretest/testdata/api/task-ready.json
@@ -1 +1 @@
-{"id":"tk0001","revision":9,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"ready_to_merge","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false},{"id":"s_0002","revision":2,"task_id":"tk0001","index":2,"specialist":"checks","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","log_tail":"ok \tamadan.net/oficina/sample/panes\t0.012s","started_at":"2026-11-07T10:01:45Z","finished_at":"2026-11-07T10:02:30Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"passed","gate":"make ci","exit_code":0,"askable":false,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false},{"id":"s_0003","revision":2,"task_id":"tk0001","index":3,"specialist":"review","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"The change makes EdgeSwipe go back and keeps the pane order. Approved.","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"claude","account":"claude-a","verdict":"approve","review_label":"same_family","findings":[{"id":"rf_0001","text":"Consider a test for a swipe that starts mid-screen.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:04:10Z"}],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:04:10Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"passed","checks_reason":"","verdict":"approve","review_label":"same_family","needs_you":"merge","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":null,"reports":0}
+{"id":"tk0001","revision":9,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"ready_to_merge","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"activity":[{"kind":"read","subject":"panes/swipe.go","at":"2026-11-07T10:00:20Z"},{"kind":"edit","subject":"panes/swipe.go","at":"2026-11-07T10:01:02Z"},{"kind":"run","subject":"go test ./panes","at":"2026-11-07T10:01:20Z"}]},{"id":"s_0002","revision":2,"task_id":"tk0001","index":2,"specialist":"checks","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","log_tail":"ok \tamadan.net/oficina/sample/panes\t0.012s","started_at":"2026-11-07T10:01:45Z","finished_at":"2026-11-07T10:02:30Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"passed","gate":"make ci","exit_code":0,"askable":false,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"activity":[]},{"id":"s_0003","revision":2,"task_id":"tk0001","index":3,"specialist":"review","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"The change makes EdgeSwipe go back and keeps the pane order. Approved.","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"claude","account":"claude-a","verdict":"approve","review_label":"same_family","findings":[{"id":"rf_0001","text":"Consider a test for a swipe that starts mid-screen.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:04:10Z"}],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"activity":[]}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:04:10Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"passed","checks_reason":"","verdict":"approve","review_label":"same_family","needs_you":"merge","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":null,"reports":0,"creator_name":"Owner","source_message_id":"m_0001","source_at":"2026-11-07T09:59:58Z","duplicate_of":null,"coordinator":null}
diff --git a/internal/wire/wiretest/testdata/api/task.json b/internal/wire/wiretest/testdata/api/task.json
index e421ff6e..9b11ec8c 100644
--- a/internal/wire/wiretest/testdata/api/task.json
+++ b/internal/wire/wiretest/testdata/api/task.json
@@ -1 +1 @@
-{"id":"tk0001","revision":5,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"in_progress","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:01:40Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"","checks_reason":"","verdict":"","review_label":"","needs_you":"","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":null,"reports":0}
+{"id":"tk0001","revision":5,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"in_progress","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"activity":[{"kind":"read","subject":"panes/swipe.go","at":"2026-11-07T10:00:20Z"},{"kind":"edit","subject":"panes/swipe.go","at":"2026-11-07T10:01:02Z"},{"kind":"run","subject":"go test ./panes","at":"2026-11-07T10:01:20Z"}]}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:01:40Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"","checks_reason":"","verdict":"","review_label":"","needs_you":"","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":null,"reports":0,"creator_name":"Owner","source_message_id":"m_0001","source_at":"2026-11-07T09:59:58Z","duplicate_of":null,"coordinator":null}
diff --git a/internal/wire/wiretest/testdata/api/tasks.json b/internal/wire/wiretest/testdata/api/tasks.json
index 0a0a2a37..64014951 100644
--- a/internal/wire/wiretest/testdata/api/tasks.json
+++ b/internal/wire/wiretest/testdata/api/tasks.json
@@ -1 +1 @@
-{"items":[{"id":"tk0001","revision":5,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"in_progress","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:01:40Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"","checks_reason":"","verdict":"","review_label":"","needs_you":"","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":null,"reports":0}]}
+{"items":[{"id":"tk0001","revision":5,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"in_progress","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"activity":[{"kind":"read","subject":"panes/swipe.go","at":"2026-11-07T10:00:20Z"},{"kind":"edit","subject":"panes/swipe.go","at":"2026-11-07T10:01:02Z"},{"kind":"run","subject":"go test ./panes","at":"2026-11-07T10:01:20Z"}]}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:01:40Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"","checks_reason":"","verdict":"","review_label":"","needs_you":"","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":null,"reports":0,"creator_name":"Owner","source_message_id":"m_0001","source_at":"2026-11-07T09:59:58Z","duplicate_of":null,"coordinator":null}]}
diff --git a/internal/wire/wiretest/testdata/frames/hello.json b/internal/wire/wiretest/testdata/frames/hello.json
index 71447486..d173bbd3 100644
--- a/internal/wire/wiretest/testdata/frames/hello.json
+++ b/internal/wire/wiretest/testdata/frames/hello.json
@@ -1 +1 @@
-{"id":"r-hello-1","type":"hello","data":{"generation":3,"repos":["amadan.net/oficina/sample"],"create_in":["oficina"],"home":"","agent":"equipo-docs-t1","catalog":[{"repo":"amadan.net/oficina/sample","default_branch":"main","summary":"A sample app for Equipo tests.","names":["Sample","Woodstar"],"hints":["go"],"updated_at":"2026-11-06T09:00:00Z"}],"accounts":[{"id":"claude-a","provider":"claude","email":"owner@example.com","healthy":true,"headroom":null}],"versions":{"claude":"2.1.312","runner":"5eae410"}}}
+{"id":"r-hello-1","type":"hello","data":{"generation":3,"repos":["amadan.net/oficina/sample"],"create_in":["oficina"],"home":"","agent":"equipo-docs-t1","catalog":[{"repo":"amadan.net/oficina/sample","default_branch":"main","summary":"A sample app for Equipo tests.","names":["Sample","Woodstar"],"hints":["go"],"updated_at":"2026-11-06T09:00:00Z","head_sha":"3333333333333333333333333333333333333333","head_subject":"Swipe from the edge goes back","gate":"make ci","checks_reason":""}],"accounts":[{"id":"claude-a","provider":"claude","email":"owner@example.com","healthy":true,"headroom":null}],"versions":{"claude":"2.1.312","runner":"5eae410"}}}
diff --git a/internal/wire/wiretest/testdata/frames/step_activity.json b/internal/wire/wiretest/testdata/frames/step_activity.json
new file mode 100644
index 00000000..6a8d6426
--- /dev/null
+++ b/internal/wire/wiretest/testdata/frames/step_activity.json
@@ -0,0 +1 @@
+{"id":"r-step-activity-1","type":"step_activity","data":{"task_id":"tk0001","step_id":"s_0001","attempt":1,"kind":"read","subject":"panes/swipe.go"}}