equipo: keep the thinking line steady while the coordinator works
Paul on staging (2026-11-20): "When it was responding, the thinking kept flashing quite quickly." Three causes, all in chat-stream.js: - Every activity event drew a phrase at once. A turn's first moments bring thinking, a tool's label and then the instance's named label within milliseconds; six phrases were drawn in 160 ms. Each phrase now stays at least 1.5 s and only the latest waiting one follows. The accessible label and tooltip still change at once. - Each draw stacked an absolutely positioned layer that faded for 600 ms over the new one. The old phrase now fades in .2 s, before the new letters start, and any layer still fading goes at the next draw. - Card and task events refresh the feed, and replaceChildren took the kept thinking line out and put it back. That restarted every CSS animation, so the fading phrases came back at full opacity on top of the new one. The refresh now moves only the nodes that must move. The elapsed timer was never reset in the reproduction; it counts from the send. The new browser test guards that it keeps counting through the burst. Raises the thintest test-line budget by the new test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 files changed,
+152
−13
.rastrillo/budgets.txt+1 −1internal/equipo/static/chat-stream.js+45 −8internal/equipo/static/equipo.css+3 −1internal/thintest/thinking_browser_test.go+103 −3
CI cancelled — superseded by a newer push — run details
CI log
=== prepare === ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2 ci-box: user namespaces allowed: 233151 ci-box: cgroup: cgroup2fs ci-box: disk /home/ci/work/repos/oficina__equipo/wt/thinking-line-steady: Type Size Avail | ext4 96G 87G ci-box: disk /home/ci/.cache/equipo-ci-box: Type Size Avail | ext4 96G 87G ci-box: bwrap: fetched and verified in 0.3s ci-box: claude: fetched and verified in 1.2s ci-box: codex: fetched and verified in 3.3s ci-box: codex-code-mode-host: fetched and verified in 1.3s ci-box: libwrap: fetched and verified in 0.3s ci-box: socat: fetched and verified in 0.4s npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead ci-box: image pulled in 9.8s ci-box: pi: installed and verified in 7.2s ci-box: opencode: installed and verified in 1.9s ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 9.2s ci-box: clone deepened in 3.1s ci-box: file times set from content: 2726 files, 174 directories ci-box: ready in 16.0s === copy === EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1 ok amadan.net/oficina/equipo/internal/equipotest 0.242s === compile === go build ./... RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile + go build -tags testbuild ./... 2.2s + go list -export -test -tags testbuild -f ./... amadan: job cancelled — a newer push superseded it
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt| index ed35e14e..b049907b 100644 |
| --- a/.rastrillo/budgets.txt |
| +++ b/.rastrillo/budgets.txt |
| @@ -71,7 +71,7 @@ perf GET /tasks/{id}/files/{file} skip Research kept images: the bytes of one im |
| perf GET /api/v1/runners skip Mac runners person API: bearer-only JSON for devices; the browser shows runners in the Team section. |
| time cmd/equipo-runner 60s TestReleaseRunnerHasNoFakeWorker builds the release runner and the thin package under testbuild (about 12s locally). |
| size internal/headless - 11249 Fable follow-up: base and diagnostic gates, preview isolation and provenance guards; measured 0/11249 source/test lines (live first-stage check). |
| -size internal/thintest - 32091 Fable follow-up: base and diagnostic gates, preview isolation and provenance guards; empty conversation page and browser checks; measured 1515/32091 source/test lines. |
| +size internal/thintest - 32191 Fable follow-up: base and diagnostic gates, preview isolation and provenance guards; empty conversation page and browser checks; the steady thinking line (dwell, one phrase at a time, refresh in place); measured 1515/32191 source/test lines. |
| perf GET /api/v1/projects/{id}/merge-policy skip Merge authority person API: bearer-only JSON for devices; the browser reads the policy on /projects/{id}. |
| perf GET /api/v1/usage skip Thin v1 person API: bearer-only JSON for devices; the browser reads usage through /usage. |
diff --git a/internal/equipo/static/chat-stream.js b/internal/equipo/static/chat-stream.js| index fc6ab1f4..1eaba308 100644 |
| --- a/internal/equipo/static/chat-stream.js |
| +++ b/internal/equipo/static/chat-stream.js |
| @@ -167,10 +167,29 @@ |
| } |
| return list[deal(key, list.length) % list.length]; |
| } |
| + // Each phrase stays at least DWELL ms (Paul, 2026-11-20: "the |
| + // thinking kept flashing quite quickly"): a turn's first moments bring |
| + // thinking, a tool's label and then its named one, all within a second. |
| + // An activity that comes sooner waits, and only the latest waiting one |
| + // is drawn; the accessible label and tooltip follow it at once. |
| + var DWELL = 1500; |
| + function want(li, label) { |
| + li.wanted = label; |
| + if (li.waiting) return; |
| + var wait = DWELL - (Date.now() - (li.shownAt || 0)); |
| + if (wait <= 0) return flush(li); |
| + li.waiting = setTimeout(function () { flush(li); }, wait); |
| + } |
| + function flush(li) { |
| + var label = li.wanted; |
| + li.waiting = 0; |
| + li.wanted = null; |
| + if (label !== null && label !== undefined) draw(li, themed(li, label), false); |
| + } |
| // The next phrase of the situation, when its time has come. |
| function cycle(li) { |
| var list = phrases(li); |
| - if (list.length < 2 || !li.wordKey || Date.now() - (li.wordAt || 0) < li.wordDelay) return; |
| + if (li.waiting || list.length < 2 || !li.wordKey || Date.now() - (li.wordAt || 0) < li.wordDelay) return; |
| li.wordDelay = nextDelay(); |
| li.wordAt = Date.now(); |
| draw(li, list[deal(li.wordKey, list.length) % list.length], false); |
| @@ -222,6 +241,7 @@ |
| if (keep < b.length) while (keep > 0 && !/[\s…]/.test(b[keep - 1])) keep--; |
| } |
| li.phrase = text; |
| + li.shownAt = Date.now(); |
| var measure = phrase.querySelector("[data-measure]"); |
| measure.textContent = text; |
| var natural = measure.offsetWidth + 1; |
| @@ -233,6 +253,9 @@ |
| var gap=parseFloat(getComputedStyle(line).columnGap)||0; |
| room=Math.floor(line.clientWidth-(elapsed?elapsed.offsetWidth:0)-(sep?sep.offsetWidth:0)-gap*3-8); |
| } |
| + // One phrase at a time: the old one fades in .2 s, before the new |
| + // one's letters start (equipo.css), and one still fading goes now. |
| + phrase.querySelectorAll("[data-out]").forEach(function (old) { old.remove(); }); |
| phrase.querySelectorAll("[data-in]").forEach(function (old) { |
| old.removeAttribute("data-in"); |
| old.setAttribute("data-out", ""); |
| @@ -240,7 +263,7 @@ |
| if (i < keep) c.style.visibility = "hidden"; |
| else c.style.setProperty("--n", 0); |
| }); |
| - setTimeout(function () { old.remove(); }, 600); |
| + setTimeout(function () { old.remove(); }, 250); |
| }); |
| var next = letters(text, keep); |
| next.setAttribute("data-in", ""); |
| @@ -267,7 +290,7 @@ |
| span.textContent = label; |
| var line = li.querySelector("[equipo-activity-line]"); |
| if (line) line.title = label; |
| - draw(li, themed(li, label), false); |
| + want(li, label); |
| } |
| // The line gives way (the first words arrived) or comes back (a tool |
| // after text). |
| @@ -842,7 +865,7 @@ |
| card.querySelectorAll("textarea, input:not([type=hidden])").forEach(function (el) { if (values[el.name]) { el.value = values[el.name]; el.closest("form").setAttribute("data-has-content", ""); } }); |
| }); |
| feed.querySelectorAll("[data-message]").forEach(function (el) { shown[el.dataset.message] = true; }); |
| - feed.replaceChildren.apply(feed, Array.from(next.children).map(function (el) { |
| + var items = Array.from(next.children).map(function (el) { |
| var fresh = el.matches('[equipo-message="incoming"][data-turn-id]') && !shown[el.dataset.message]; |
| var turn = el.hasAttribute("equipo-thinking") ? el.dataset.turn : fresh ? el.dataset.turnId : ""; |
| var old = turn && keep[turn]; |
| @@ -875,15 +898,16 @@ |
| return old; |
| } |
| return settle(old, el); |
| - }).filter(Boolean)); |
| + }).filter(Boolean); |
| + // A stale page lacks lines for turns that started since: they stay. |
| + if (stale) Object.keys(keep).forEach(function (turn) { if (!ended[turn] && !queued[turn]) items.push(keep[turn]); }); |
| + // Lines shown since a send that no turn has adopted yet come last. |
| + arrange(items.concat(pending)); |
| if(cardFocus) { |
| var target=feed.querySelector('[data-card="'+CSS.escape(cardFocus.id)+'"] [name="'+CSS.escape(cardFocus.name)+'"]'); |
| if(target) {target.focus({preventScroll:true});if(target.setSelectionRange)target.setSelectionRange(cardFocus.start,cardFocus.end);} |
| } |
| - // A stale page lacks lines for turns that started since: they stay. |
| - if (stale) Object.keys(keep).forEach(function (turn) { if (!ended[turn] && !queued[turn]) feed.append(keep[turn]); }); |
| local.forEach(function (el) { place(el); }); |
| - pending.forEach(function (el) { feed.append(el); }); |
| Object.keys(drafts).forEach(function (turn) { |
| if (feed.querySelector('[equipo-thinking][data-turn="' + CSS.escape(turn) + '"], [data-roster-turn="' + CSS.escape(turn) + '"] [equipo-thread-draft]')) showDraft(turn); |
| }); |
| @@ -892,6 +916,19 @@ |
| scroll(); |
| }); |
| } |
| + // arrange makes the feed the items, in order, moving only what must |
| + // move: an element taken out and put back starts its animations again, |
| + // so a thinking line kept across a refresh drew every fading phrase |
| + // over the new one (Paul, 2026-11-20). |
| + function arrange(items) { |
| + var keep = new Set(items); |
| + Array.from(feed.childNodes).forEach(function (n) { if (!keep.has(n)) n.remove(); }); |
| + var at = feed.firstChild; |
| + items.forEach(function (el) { |
| + if (el === at) at = at.nextSibling; |
| + else feed.insertBefore(el, at); |
| + }); |
| + } |
| function apply(type, data) { |
| var e = JSON.parse(data); |
| if (e.cursor <= cursor) return; |
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css| index 161001e1..089f510e 100644 |
| --- a/internal/equipo/static/equipo.css |
| +++ b/internal/equipo/static/equipo.css |
| @@ -232,7 +232,9 @@ html:has([equipo-conversation]) { overflow: hidden; scrollbar-gutter: auto; } |
| [equipo-phrase] > span > span { display: inline-block; white-space: pre; } |
| [equipo-phrase] > [data-in] > span { animation: equipo-letter-in .32s ease-out calc(.2s + var(--n) * var(--stagger, 14ms)) both, equipo-wave 3.2s ease-in-out calc(.7s + var(--j) * 45ms) infinite; } |
| [equipo-phrase] > [data-in] > [data-keep] { animation: equipo-wave 3.2s ease-in-out calc(.7s + var(--j) * 45ms) infinite; } |
| -[equipo-phrase] > [data-out] > span, [equipo-activity-line][data-leaving] [equipo-phrase] > span > span { animation: equipo-letter-out .6s ease both; } |
| +/* The old phrase is gone in .2 s, as the new one's letters start. */ |
| +[equipo-phrase] > [data-out] > span { animation: equipo-letter-out .2s ease-in both; } |
| +[equipo-activity-line][data-leaving] [equipo-phrase] > span > span { animation: equipo-letter-out .6s ease both; } |
| @keyframes equipo-letter-in { from { opacity: 0; transform: translateY(.18em); } } |
| @keyframes equipo-letter-out { to { opacity: 0; transform: translateY(-.15em); } } |
| @keyframes equipo-wave { 0%, 22%, 100% { color: var(--rst-text); } 8% { color: var(--rst-accent); } } |
diff --git a/internal/thintest/thinking_browser_test.go b/internal/thintest/thinking_browser_test.go| index ff921bfc..a61a6f20 100644 |
| --- a/internal/thintest/thinking_browser_test.go |
| +++ b/internal/thintest/thinking_browser_test.go |
| @@ -7,6 +7,7 @@ import ( |
| "encoding/json" |
| "fmt" |
| "testing" |
| + "time" |
| "amadan.net/oficina/equipo/internal/wire" |
| "github.com/chromedp/cdproto/cdp" |
| @@ -97,7 +98,8 @@ func TestBrowserThinkingWords(t *testing.T) { |
| // phrases come from a shuffled deck, none again until all have shown, |
| // across two turns (a reload keeps only localStorage); after the deck runs |
| // out the next is none of the last three; a tool shows its plain label |
| -// at once; under reduced motion the thinking words still change. |
| +// once the phrase before has had its 1.5 s; under reduced motion the |
| +// thinking words still change. |
| // |
| // The page's clock stands still but for the test (clock below): each |
| // phrase is held to just under its minimum while the phrase timer looks, |
| @@ -217,11 +219,11 @@ func TestBrowserThinkingCycles(t *testing.T) { |
| } |
| } |
| dwelt(from) |
| - // A tool activity: its plain label at once. |
| + // A tool activity: its plain label, after the phrase's dwell. |
| if err := r.runner.Send(r.ctx, "cyc-read-"+motion, wire.FrameActivity, wire.ActivityReport{TurnID: r.turn, Attempt: 1, Kind: wire.ActivityTool, Tool: wire.ToolReadFile}); err != nil { |
| t.Fatal(err) |
| } |
| - p.wait(phrase+`==='Reading the code…'`, "a plain reading label at once") |
| + p.wait(phrase+`==='Reading the code…'`, "a plain reading label after the dwell") |
| if motion == "reduce" { |
| p.check(`getComputedStyle(document.querySelector('[equipo-sparkle] path')).animationName==='none'`, "the mark moves under reduced motion") |
| } |
| @@ -231,3 +233,101 @@ func TestBrowserThinkingCycles(t *testing.T) { |
| } |
| } |
| } |
| + |
| +// TestBrowserThinkingSteady: Paul on staging, 2026-11-20: "When it was |
| +// responding, the thinking kept flashing quite quickly." A turn's first |
| +// moments bring a burst: thinking, the runner's tool label and then the |
| +// instance's named one, and cards whose refreshes re-rendered the feed. |
| +// Every activity drew a phrase at once over the ones still fading, and |
| +// each refresh took the line out and put it back, so every fading phrase |
| +// started its animation again on top of the new one. Now each phrase |
| +// stays at least 1.5 s and the latest waiting one follows, one phrase |
| +// shows at a time, a refresh leaves the line where it is, and the timer |
| +// counts the whole turn. |
| +func TestBrowserThinkingSteady(t *testing.T) { |
| + r := newToolRig(t) |
| + if err := r.runner.Send(r.ctx, "r-first", wire.FrameReply, wire.Reply{TurnID: r.turn, Attempt: 1, Text: "First."}); err != nil { |
| + t.Fatal(err) |
| + } |
| + r.wait("replied", func(c *Conversation) bool { return c.Turns[r.turn].State == wire.TurnReplied }) |
| + // The page's record: each phrase drawn, the most phrases visible at |
| + // once (letters a new phrase keeps from the old one are the old |
| + // ones'), how often a line left the page, and the timer each frame. |
| + const watch = `(()=>{window.__drawn=[];window.__most=0;window.__left=0;window.__timer=[];` + |
| + `new MutationObserver(ms=>{for(const m of ms){for(const n of m.addedNodes)if(n.nodeType===1&&n.matches('[equipo-phrase] > [data-in]'))__drawn.push({text:n.textContent,at:performance.now()});for(const n of m.removedNodes)if(n.nodeType===1&&n.matches('[equipo-thinking]'))__left++}}).observe(document,{childList:true,subtree:true});` + |
| + `const frame=()=>{const shown=[...document.querySelectorAll('[equipo-phrase] > [data-in], [equipo-phrase] > [data-out]')].filter(l=>[...l.children].some(c=>{const s=getComputedStyle(c);return !c.hasAttribute('data-keep')&&s.visibility!=='hidden'&&Number(s.opacity)>.1})).length;__most=Math.max(__most,shown);const e=document.querySelector('[equipo-elapsed]');if(e&&e.textContent)__timer.push(parseInt(e.textContent));requestAnimationFrame(frame)};requestAnimationFrame(frame)})()` |
| + p := openInner(t, r.inst.URL, r.inst.Cookie(), 1280, 900, false, "light", "no-preference") |
| + defer p.stop() |
| + p.do(chromedp.Func(func(ctx context.Context, target *chromedp.Target) error { |
| + _, err := cdp.Call(ctx, target, page.AddScriptToEvaluateOnNewDocument, page.AddScriptToEvaluateOnNewDocumentParams{Source: watch}) |
| + return err |
| + })) |
| + p.open("/conversation") |
| + p.wait(`document.querySelector('#composer textarea')`, "the composer") |
| + sent := time.Now() |
| + p.check(`(()=>{const box=document.querySelector('#composer textarea');box.value='Fix the swipe';box.dispatchEvent(new Event('input'));document.querySelector('#composer').requestSubmit();return true})()`, "send") |
| + f, body, err := r.runner.Expect(r.ctx, wire.FrameMessage) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := r.runner.Send(r.ctx, "a-fix", wire.FrameAck, wire.Ack{ID: f.ID}); err != nil { |
| + t.Fatal(err) |
| + } |
| + r.turn = body.(*wire.MessageCommand).TurnID |
| + p.wait(`document.querySelector('[equipo-thinking][data-turn=`+jsString(r.turn)+`]')`, "the turn's line") |
| + act := func(id, kind, tool string) { |
| + t.Helper() |
| + if err := r.runner.Send(r.ctx, id, wire.FrameActivity, wire.ActivityReport{TurnID: r.turn, Attempt: 1, Kind: kind, Tool: tool}); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + from := eval[int](p, `__drawn.length`) |
| + burst := time.Now() |
| + act("s1", wire.ActivityThink, "") |
| + act("s2", wire.ActivityTool, wire.ToolRecordTask) |
| + task := taskID(t, r.call("s-rec", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Swipe back", "brief": "x"})) |
| + act("s3", wire.ActivityThink, "") |
| + act("s4", wire.ActivityTool, wire.ToolStartTask) |
| + r.call("s-start", wire.ToolStartTask, map[string]string{"task": task, "brief": "go"}) |
| + r.expect(wire.FrameDispatch) |
| + act("s5", wire.ActivityThink, "") |
| + took := time.Since(burst) |
| + words, _ := r.client.Thinking(r.ctx) |
| + var think []string |
| + for _, s := range words.Sets { |
| + if s.ID == wire.DefaultThinking { |
| + think = s.Phrases["think"] |
| + } |
| + } |
| + thinks, _ := json.Marshal(think) |
| + line := `document.querySelector('[equipo-thinking][data-turn=` + jsString(r.turn) + `]')` |
| + p.wait(line+`?.querySelector('[equipo-activity]').textContent==='Thinking' && document.querySelector('[data-card]')`, "the latest activity for screen readers, and the task's card") |
| + // The latest waiting phrase comes once the one before has had its time. |
| + p.wait(`(()=>{const d=__drawn.slice(`+fmt.Sprint(from)+`);return d.length>0 && performance.now()-d[d.length-1].at>1700 && `+string(thinks)+`.includes(d[d.length-1].text)})()`, "the burst settles on a thinking phrase") |
| + drawn := eval[[]map[string]any](p, `__drawn.slice(`+fmt.Sprint(from)+`)`) |
| + if most := 2 + int(took/(1500*time.Millisecond)); len(drawn) > most { |
| + t.Fatalf("%d phrases for a burst of %s, want at most %d: %v", len(drawn), took, most, drawn) |
| + } |
| + all := eval[[]map[string]any](p, `__drawn`) |
| + for i := 1; i < len(all); i++ { |
| + if gap := all[i]["at"].(float64) - all[i-1]["at"].(float64); gap < 1450 { |
| + t.Fatalf("%q came %.0f ms after %q: %v", all[i]["text"], gap, all[i-1]["text"], all) |
| + } |
| + } |
| + if most := eval[int](p, `__most`); most > 1 { |
| + t.Fatalf("%d phrases visible at once", most) |
| + } |
| + if left := eval[int](p, `__left`); left > 0 { |
| + t.Fatalf("the thinking line left the page %d times while the turn ran", left) |
| + } |
| + timer := eval[[]int](p, `__timer`) |
| + for i := 1; i < len(timer); i++ { |
| + if timer[i] < timer[i-1] { |
| + t.Fatalf("the timer went from %ds to %ds", timer[i-1], timer[i]) |
| + } |
| + } |
| + if got, want := timer[len(timer)-1], int(time.Since(sent).Seconds())-1; got < want { |
| + t.Fatalf("the timer shows %ds, %ds after the send", got, want+1) |
| + } |
| + p.stayed("the burst") |
| +} |