judge fetch retries; old suites expect the thin sidebar
A checks or review step retries its project fetch with backoff before clone_failed: on staging the first checks after an upgrade hit the hub while both runners were re-indexing. The old engine suites now assert the thin sidebar (its five links, no old pages) instead of the old one; their pages stay served until the slice 7 sweep.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+49
−13
internal/equipotest/pages_test.go+14 −3internal/equipotest/task_pages_test.go+3 −1internal/plan3test/specialist_library_test.go+3 −1internal/plan3test/teams_navigation_test.go+10 −7internal/runner/thin/judge.go+19 −1
CI failed — run details
Intent
diff --git a/internal/equipotest/pages_test.go b/internal/equipotest/pages_test.go| index 65792041..82a425b8 100644 |
| --- a/internal/equipotest/pages_test.go |
| +++ b/internal/equipotest/pages_test.go |
| @@ -9,6 +9,7 @@ import ( |
| "net/http/httptest" |
| "net/url" |
| "regexp" |
| + "slices" |
| "strings" |
| "testing" |
| @@ -22,6 +23,11 @@ const memberAddress = "reader@example.com" |
| var railPaths = []string{"/teams", "/conversation", "/tasks", "/needs-you", "/journey", "/projects", "/specialists/product", "/specialists/design", "/specialists/copy", "/specialists/engineering", "/specialists/review", "/playbooks", "/templates", "/preferences", "/settings/coordinator", "/connections", "/people", "/settings"} |
| var railNames = []string{"switch", "Conversation", "Tasks", "Needs you", "Journey", "Projects", "Product", "Design", "Copy", "Engineering", "Review", "Playbooks", "Template library", "Preferences", "Your coordinator", "Connections", "People", "Settings"} |
| +// railLinks are the thin v1 sidebar's links (slice 4): the pages above |
| +// that the thin core does not back are still served, but not linked. |
| +var railLinks = []string{"/conversation", "/tasks", "/projects", "/tasks?needs=you", "/people"} |
| +var railLinkNames = []string{"Conversation", "Tasks", "Projects", "Needs you", "People"} |
| + |
| func newPageFixture(t *testing.T) authFixture { |
| t.Helper() |
| logger := slog.New(slog.NewTextHandler(io.Discard, nil)) |
| @@ -91,16 +97,21 @@ func TestRailRoutes(t *testing.T) { |
| body := pageBody(t, c, f.server.URL, path) |
| nav := regexp.MustCompile(`(?s)<nav rst-shell-nav[^>]*>.*?</nav>`).FindString(body) |
| links := regexp.MustCompile(`(?s)<a id="nav-[^>]*>.*?</a>`).FindAllString(nav, -1) |
| - if len(links) != len(railPaths) { |
| + if len(links) != len(railLinks) { |
| t.Fatalf("%s: %d rail destinations", path, len(links)) |
| } |
| for i, link := range links { |
| - if !strings.Contains(link, `href="`+railPaths[i]+`"`) || !strings.Contains(link, railNames[i]) || (i > 0 && !strings.Contains(link, "<svg")) { |
| + if !strings.Contains(link, `href="`+railLinks[i]+`"`) || !strings.Contains(link, railLinkNames[i]) || !strings.Contains(link, "<svg") { |
| t.Fatalf("rail entry %d: %s", i, link) |
| } |
| } |
| currentCount := strings.Count(body, `aria-current="page"`) |
| - want := 1 |
| + // Only a page the thin sidebar links (or names: the old Needs you |
| + // page keeps its key) is its current page. |
| + want := 0 |
| + if slices.Contains(railLinks, path) || path == "/needs-you" { |
| + want = 1 |
| + } |
| if path == "/work" { |
| want = 0 |
| if !strings.Contains(body, `rst-shell-sidebar="index"`) { |
diff --git a/internal/equipotest/task_pages_test.go b/internal/equipotest/task_pages_test.go| index 0318cd72..ee717203 100644 |
| --- a/internal/equipotest/task_pages_test.go |
| +++ b/internal/equipotest/task_pages_test.go |
| @@ -183,7 +183,9 @@ func TestTaskLayoutRules(t *testing.T) { |
| t.Fatal("forbidden task layout", bad) |
| } |
| } |
| - if strings.Count(body, `aria-current="page"`) != 1 || !strings.Contains(body, "equipo-steps") || !strings.Contains(body, `rel="up"`) { |
| + // The old journey page is no longer in the thin sidebar (slice 4), so |
| + // nothing there is the current page. |
| + if strings.Count(body, `aria-current="page"`) > 1 || !strings.Contains(body, "rst-shell-nav") || !strings.Contains(body, "equipo-steps") || !strings.Contains(body, `rel="up"`) { |
| t.Fatal("missing shell or step chips") |
| } |
| } |
diff --git a/internal/plan3test/specialist_library_test.go b/internal/plan3test/specialist_library_test.go| index 7902df4b..168ff206 100644 |
| --- a/internal/plan3test/specialist_library_test.go |
| +++ b/internal/plan3test/specialist_library_test.go |
| @@ -242,7 +242,9 @@ func TestSpecialistTemplateForms(t *testing.T) { |
| t.Fatal("active member could not create", w.Code, w.Body.String()) |
| } |
| key := strings.TrimPrefix(w.Header().Get("Location"), "/specialists/") |
| - for _, path := range []string{"/specialists/" + key, "/specialists/" + key + "/edit", "/work"} { |
| + // Custom specialists are an old-engine page; the thin sidebar (slice |
| + // 4) does not list them, so /work no longer names them. |
| + for _, path := range []string{"/specialists/" + key, "/specialists/" + key + "/edit"} { |
| w = f.get(t, peer, path) |
| if w.Code != 200 || !strings.Contains(w.Body.String(), "Web QA") { |
| t.Fatal("custom specialist missing from page", path, w.Code) |
diff --git a/internal/plan3test/teams_navigation_test.go b/internal/plan3test/teams_navigation_test.go| index 8f99f73c..1a38e5a2 100644 |
| --- a/internal/plan3test/teams_navigation_test.go |
| +++ b/internal/plan3test/teams_navigation_test.go |
| @@ -17,8 +17,9 @@ func TestTeamsHierarchy(t *testing.T) { |
| custom, err := f.Store.CreateSpecialist(ctx, owner, specialistInput("Custom QA"), equipo.Mutation{RequestID: "nav-specialist"}) |
| must(t, err) |
| body := f.get(t, owner, "/work").Body.String() |
| - if !strings.Contains(body, `href="/specialists/`+custom.Key+`"`) || !strings.Contains(body, "Custom QA") { |
| - t.Fatal("custom specialist missing from navigation") |
| + // The thin sidebar (slice 4) lists only what the thin core backs. |
| + if strings.Contains(body, `href="/specialists/`+custom.Key+`"`) { |
| + t.Fatal("an old-engine specialist page is in the navigation") |
| } |
| for path, up := range map[string]string{"/work": "/teams", "/conversation": "/work#nav-conversation", "/preferences": "/work#nav-preferences", "/playbooks": "/work#nav-playbooks", "/settings/coordinator": "/work#nav-coordinator", "/tasks/" + task.ID: "/journey", "/tasks/" + task.ID + "/thread": "/tasks/" + task.ID} { |
| w := f.get(t, owner, path) |
| @@ -26,14 +27,16 @@ func TestTeamsHierarchy(t *testing.T) { |
| if !strings.Contains(w.Body.String(), `href="`+up+`" rel="up"`) { |
| t.Errorf("%s missing parent %s", path, up) |
| } |
| - if !strings.Contains(w.Body.String(), `href="/teams"`) { |
| - t.Errorf("%s missing Teams link", path) |
| + if strings.Contains(w.Body.String(), `id="nav-teams"`) { |
| + t.Errorf("%s links the old team switch", path) |
| } |
| } |
| w := f.get(t, owner, "/work") |
| - for _, href := range []string{"/preferences", "/playbooks", "/settings/coordinator"} { |
| - if !strings.Contains(w.Body.String(), `href="`+href+`"`) { |
| - t.Errorf("missing navigation %s", href) |
| + nav := w.Body.String()[strings.Index(w.Body.String(), "<nav rst-shell-nav"):] |
| + nav = nav[:strings.Index(nav, "</nav>")] |
| + for _, href := range []string{"/preferences", "/playbooks", "/settings/coordinator", "/journey"} { |
| + if strings.Contains(nav, `href="`+href+`"`) { |
| + t.Errorf("old page %s in the navigation", href) |
| } |
| } |
| expectHTTP(t, f.get(t, owner, "/teams"), 200) |
diff --git a/internal/runner/thin/judge.go b/internal/runner/thin/judge.go| index b740904c..11c62204 100644 |
| --- a/internal/runner/thin/judge.go |
| +++ b/internal/runner/thin/judge.go |
| @@ -42,8 +42,20 @@ func (e *Engineer) judgeTree(ctx context.Context, r stepRow) (workspace.TaskTree |
| if err := e.lease(ctx); err != nil { |
| return workspace.TaskTree{}, "cancelled", err |
| } |
| - if err := e.Clones.Ensure(ctx, r.Repo); err != nil { |
| + // The hub may refuse a burst of fetches (a runner that just started |
| + // indexes every repository): try again before giving up. |
| + var err error |
| + for i := 0; i < fetchAttempts; i++ { |
| + if err = e.Clones.Ensure(ctx, r.Repo); err == nil || ctx.Err() != nil { |
| + break |
| + } |
| e.log("judge clone", err) |
| + select { |
| + case <-ctx.Done(): |
| + case <-time.After(time.Duration(i+1) * fetchBackoff): |
| + } |
| + } |
| + if err != nil { |
| return workspace.TaskTree{}, "clone_failed", err |
| } |
| t := e.tree(r, r.CandidateSHA) |
| @@ -57,6 +69,12 @@ func (e *Engineer) judgeTree(ctx context.Context, r stepRow) (workspace.TaskTree |
| return tree, "", nil |
| } |
| +// fetchAttempts and fetchBackoff pace a judge's fetch retries. |
| +var ( |
| + fetchAttempts = 4 |
| + fetchBackoff = 10 * time.Second |
| +) |
| + |
| var shaPattern = regexp.MustCompile(`^(?:[0-9a-f]{40}|[0-9a-f]{64})$`) |
| // lease waits for the execution lease: nothing runs without it. |