paseo-follow-up 2.6.0-beta.4 → 2.6.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,14 @@ export function subscribeDisplay(listener: (values: Display) => void) { listener
21
21
  let latest: Display | null = null;
22
22
  listeners.add(values => { latest = values; });
23
23
  export const displayValues = (): Display | null => latest;
24
+ /**
25
+ * The Display document as it arrives (the feed's push or a read), for Home's order (client/home-view.ts): one
26
+ * follow.display-feed per client, the Display store's (invariant 142). A late follower gets the last document at once.
27
+ */
28
+ type DisplayDoc = { status: string; values?: unknown };
29
+ let latestDoc: DisplayDoc | null = null;
30
+ const docFollowers = new Set<(doc: DisplayDoc) => void>();
31
+ export function followDisplayDoc(follower: (doc: DisplayDoc) => void) { docFollowers.add(follower); if (latestDoc) follower(latestDoc); return () => { docFollowers.delete(follower); }; }
24
32
 
25
33
  /** R2's measurement, where it's cheap to look: how often agents stated what they need on a flagged turn. */
26
34
  export function briefShareText(stats: { days: number; total: number; tool: number; structured: number; fallback: number } | undefined): string {
@@ -156,8 +164,9 @@ export function contributeDisplay(client: PluginClientContext, item: PluginSideb
156
164
  // Retain the last valid preference through temporary disconnects.
157
165
  } finally { pending = false; }
158
166
  };
159
- const apply = (result: { status: string; values?: unknown }) => {
167
+ const apply = (result: DisplayDoc) => {
160
168
  if (!disposed && result.status === "ready") {
169
+ latestDoc = result; for (const follower of docFollowers) follower(result);
161
170
  const parsed = displayPreferences.schema.safeParse(result.values);
162
171
  if (parsed.success) { sidebar.set(parsed.data.showSidebar); for (const listener of listeners) listener(parsed.data); }
163
172
  }
@@ -175,7 +184,7 @@ export function contributeDisplay(client: PluginClientContext, item: PluginSideb
175
184
  return () => {
176
185
  disposed = true; feed?.stop();
177
186
  if (timer) clearInterval(timer); offVisible();
178
- listeners.delete(update);
187
+ listeners.delete(update); latestDoc = null;
179
188
  sidebar.dispose();
180
189
  };
181
190
  }
@@ -1,5 +1,5 @@
1
1
  import { FloatingSurface } from "./floating-surface";
2
- import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
2
+ import { useCallback, useDeferredValue, useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
3
3
  import { Platform, View, type TextInput } from "react-native";
4
4
  import { AttachImageButton, ImageField, useImageAttachments, type ImageAttachments } from "./image-attach";
5
5
  import { OVERSEER_ASK_KEY } from "./unsent-images";
@@ -36,9 +36,11 @@ export type Omnibox = {
36
36
  setQuery(q: string): void;
37
37
  setPhysical?: (q: string | null) => void;
38
38
  layoutHint?: string | null;
39
- /** null while the query is empty: the list shows its groups. */
39
+ /** null while the query is empty: the list shows its groups. They may trail `query` by a key (useDeferredValue). */
40
40
  results: OmniboxItem[] | null;
41
41
  active: number;
42
+ /** What Enter takes: the active result for the query as typed, even when the list hasn't caught up with it yet. */
43
+ enterItem(): OmniboxItem | null;
42
44
  move(delta: number): void;
43
45
  inputRef: React.RefObject<TextInput | null>;
44
46
  /** The search field's onLayout: a waiting search request tries again when the field comes on screen. */
@@ -67,7 +69,10 @@ export function useOmnibox(model: HomeModel, sources: HomeSources, extraProvider
67
69
  const live = useSyncExternalStore(sources.live.subscribe, sources.live.version, sources.live.version);
68
70
  const paseo = useSyncExternalStore(sources.paseo.subscribe, sources.paseo.version, sources.paseo.version);
69
71
  const extras = useSyncExternalStore(sources.extras.subscribe, sources.extras.version, sources.extras.version);
70
- const searching = query.trim().length > 0;
72
+ // typing-never-redraws-unchanged-rows (invariant 148): the field takes each key at once; the results follow the
73
+ // typed query at low priority, so a key never waits on the list, and a newer key drops a list render still running.
74
+ const shown = useDeferredValue(query);
75
+ const searching = shown.trim().length > 0;
71
76
  const overseer = useSyncExternalStore(sources.extras.subscribe, sources.extras.overseer, sources.extras.overseer);
72
77
  const askOn = !!overseer?.enabled;
73
78
  // An ask Paseo hasn't taken yet keeps its images under OVERSEER_ASK_KEY (client/unsent-images.ts).
@@ -75,11 +80,14 @@ export function useOmnibox(model: HomeModel, sources: HomeSources, extraProvider
75
80
  // Linked keys and titles: fetched only while there's a query (client/linked.tsx explains why).
76
81
  const linked = useLinkedIndex(searching);
77
82
  // Built lazily: nothing is indexed until the developer types.
78
- const index = useMemo(() => searching ? indexDocs(homeSearchDocs({ model, paseo: sources.paseo.all(), tracked: sources.live.all(), archived: sources.live.archived(), agents: sources.extras.agents(), linked })) : null,
83
+ const buildIndex = () => indexDocs(homeSearchDocs({ model, paseo: sources.paseo.all(), tracked: sources.live.all(), archived: sources.live.archived(), agents: sources.extras.agents(), linked }));
84
+ const index = useMemo(() => searching ? buildIndex() : null,
79
85
  // eslint-disable-next-line react-hooks/exhaustive-deps
80
86
  [searching, model, live, paseo, extras, linked]);
81
- const providers = useMemo(() => index ? [workspaceProvider(index, Date.now(), physical), ...extraProviders, overseerProvider(askOn)] : [], [index, extraProviders, askOn, physical]);
82
- const results = useMemo(() => searching ? omniboxResults(providers, query) : null, [providers, query, searching]);
87
+ const providersOf = (i: ReturnType<typeof indexDocs>) => [workspaceProvider(i, Date.now(), physical), ...extraProviders, overseerProvider(askOn)];
88
+ // eslint-disable-next-line react-hooks/exhaustive-deps
89
+ const providers = useMemo(() => index ? providersOf(index) : [], [index, extraProviders, askOn, physical]);
90
+ const results = useMemo(() => searching ? omniboxResults(providers, shown) : null, [providers, shown, searching]);
83
91
  const setQuery = useCallback((q: string) => { setQueryState(q); setActive(null); }, []);
84
92
  const fallback = defaultActive(results);
85
93
  const current = active ?? fallback;
@@ -90,7 +98,16 @@ export function useOmnibox(model: HomeModel, sources: HomeSources, extraProvider
90
98
  const onSearchLayout = useSearchFocusField(sources.extras.searchFocus, inputRef, setQuery);
91
99
  const focusSearch = useCallback(() => { const f = sources.extras.searchFocus; if (!f.shown()) return false; f.request(); return true; }, [sources.extras.searchFocus]);
92
100
  const hint = layoutHint((results ?? []).flatMap(r => r.hit ? [r.hit] : []));
93
- return { query, setQuery, setPhysical, layoutHint: hint, results, active: Math.min(current, Math.max(0, (results?.length ?? 1) - 1)), move, inputRef, onSearchLayout, focusSearch, askOn, images };
101
+ const shownActive = Math.min(current, Math.max(0, (results?.length ?? 1) - 1));
102
+ // Enter right after a key: the list may still show the query before it, so Enter reads the typed query's own results
103
+ // (Ask the Overseer sends what was typed, never the query a key earlier).
104
+ const enterItem = (): OmniboxItem | null => {
105
+ if (shown === query) return results?.[shownActive] ?? null;
106
+ if (!query.trim()) return null;
107
+ const fresh = omniboxResults(providersOf(index ?? buildIndex()), query);
108
+ return fresh[defaultActive(fresh)] ?? null;
109
+ };
110
+ return { query, setQuery, setPhysical, layoutHint: hint, results, active: shownActive, enterItem, move, inputRef, onSearchLayout, focusSearch, askOn, images };
94
111
  }
95
112
 
96
113
  type DomKey = { key: string; metaKey: boolean; ctrlKey: boolean; altKey: boolean; target: unknown; preventDefault(): void };
@@ -193,16 +210,16 @@ export function QueryField({ theme, value, onChange, placeholder, icon, dense, i
193
210
  */
194
211
  /** `onEnter`: the active result, or null when the query is empty (Home then opens its selection). */
195
212
  export function SearchField({ theme, omnibox, dense, onEnter, anywhereKey }: { theme: Theme; omnibox: Omnibox; dense: boolean; onEnter: (item: OmniboxItem | null) => void; anywhereKey?: string | null }) {
196
- const { query, setQuery, results, active, move, inputRef, askOn } = omnibox;
213
+ const { query, setQuery, move, inputRef, askOn } = omnibox;
197
214
  const placeholder = askOn ? dense ? "Search or ask the Overseer" : "Search, or ask the Overseer" : "Search workspaces, branches, PRs";
198
215
  // The bar stays one line: a paste or drop lands here, and Home draws the thumbnails on their own line under it.
199
216
  if (askOn) return <ImageField model={omnibox.images} theme={theme} compact={dense} row={false} attach="inline" style={{ flex: 1, minWidth: 0 }}><QueryField theme={theme} onLayoutQuery={omnibox.setPhysical} value={query} onChange={setQuery} placeholder={placeholder} icon="Search" dense={dense} inputRef={inputRef} onLayout={omnibox.onSearchLayout} slashHint={anywhereKey || "/"}
200
217
  trailing={<AttachImageButton model={omnibox.images} theme={theme} compact={dense} label="Add image for the Overseer" />}
201
218
  slashTitle={anywhereKey ? `${anywhereKey} from anywhere · / on Home` : "/ focuses the search"}
202
- onSubmit={() => { const item = results?.[active]; if (item || !query.trim()) onEnter(item ?? null); }} onArrow={move} listKeys={!query.trim()} /></ImageField>;
219
+ onSubmit={() => { const item = omnibox.enterItem(); if (item || !query.trim()) onEnter(item ?? null); }} onArrow={move} listKeys={!query.trim()} /></ImageField>;
203
220
  return <QueryField theme={theme} onLayoutQuery={omnibox.setPhysical} value={query} onChange={setQuery} placeholder={placeholder} icon="Search" dense={dense} inputRef={inputRef} onLayout={omnibox.onSearchLayout} slashHint={anywhereKey || "/"}
204
221
  slashTitle={anywhereKey ? `${anywhereKey} from anywhere · / on Home` : "/ focuses the search"}
205
- onSubmit={() => { const item = results?.[active]; if (item || !query.trim()) onEnter(item ?? null); }} onArrow={move} listKeys={!query.trim()} />;
222
+ onSubmit={() => { const item = omnibox.enterItem(); if (item || !query.trim()) onEnter(item ?? null); }} onArrow={move} listKeys={!query.trim()} />;
206
223
  }
207
224
 
208
225
  /**
@@ -4,7 +4,7 @@ import { View, type FlatList as NativeFlatList } from "react-native";
4
4
  import { Pressable, Text } from "./text";
5
5
  import { Icon, FlatList } from "@getpaseo/plugin/client/ui";
6
6
  import { type Badge, type HomeGroupId, type HomeModel, type Workstream, prChipSpoken, railChips } from "../shared/home";
7
- import { ASK_KEY, excerpt, FIELD_LABEL, type OmniboxItem, type Range, type RowHit, type SearchHit } from "../shared/search";
7
+ import { ASK_KEY, excerpt, FIELD_LABEL, type OmniboxItem, type Range, type RowHit, type SearchHit, sameHit } from "../shared/search";
8
8
  import { AskRow, PriorityLine } from "./home-chrome";
9
9
  import { age, wakeLabel, wakeShort } from "../shared/inbox";
10
10
  import { headlineColor, mergedColor, readable, runningColor, tint, toneColor, withAlpha, type Colors } from "./theme";
@@ -129,10 +129,14 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
129
129
  // eslint-disable-next-line react-hooks/exhaustive-deps
130
130
  [model, closed, openProjects, pages, briefLine, results, hits, filter, !!overseer, touch, !!afterNeeds, arranged]);
131
131
  // A result picks through onResult; Row only knows its key.
132
+ // Read through a ref, so a key that brings new results (and Home's new onResult) never hands every row a new onSelect
133
+ // (typing-never-redraws-unchanged-rows).
134
+ const picking = useRef({ results, onResult }); picking.current = { results, onResult };
132
135
  const pickResult = useCallback((key: string) => {
136
+ const { results, onResult } = picking.current;
133
137
  const item = results?.find(i => !i.ask && i.key === key);
134
138
  if (item) onResult?.(item);
135
- }, [results, onResult]);
139
+ }, []);
136
140
 
137
141
  const render = useCallback(({ item }: { item: Entry }) => {
138
142
  switch (item.type) {
@@ -305,10 +309,16 @@ export function WakeTime({ until, c, size = 12 }: { until: string; c: Colors; si
305
309
  const text = wakeShort(until, Math.max(now, Date.now()));
306
310
  return text ? <Text style={{ color: c.foregroundMuted, fontSize: size, fontVariant: ["tabular-nums"], minWidth: 26, textAlign: "right" }}>{text}</Text> : null;
307
311
  }
312
+ /**
313
+ * typing-never-redraws-unchanged-rows (invariant 148): how many times a row and its chip rail drew, read by
314
+ * tests/search-rows.test.ts. A row draws again only when what it shows moved; its rail and time only when the row did.
315
+ */
316
+ let rowDraws = 0, chipRails = 0;
317
+ export const rowRenders = () => ({ rows: rowDraws, rails: chipRails });
308
318
  /** The right-hand time: when a Later row comes back, otherwise how long ago. */
309
- function RowTime({ s, c, size }: { s: Workstream; c: Colors; size: number }) {
319
+ const RowTime = memo(function RowTime({ s, c, size }: { s: Workstream; c: Colors; size: number }) {
310
320
  return <View testID="follow-up-row-time" style={{ flexShrink: 0 }}>{s.group === "later" && s.wakeAt ? <WakeTime until={s.wakeAt} c={c} size={size} /> : <Age iso={s.at} c={c} size={size} />}</View>;
311
- }
321
+ }, (a, b) => a.s.sig === b.s.sig && a.c === b.c && a.size === b.size);
312
322
 
313
323
  /**
314
324
  * row-chips-never-cover-the-time: a desktop row's badges and PR chip, in priority order (most telling first). They yield
@@ -316,13 +326,15 @@ function RowTime({ s, c, size }: { s: Workstream; c: Colors; size: number }) {
316
326
  * clips (so the lowest-priority chips drop, last first), and a lone chip truncates. Guarded by
317
327
  * `scripts/screenshots.mjs --only rowchips` (CDP boxes at list widths 320, 360 and 400) and tests/row-chips.test.ts.
318
328
  */
319
- function ChipRail({ s, c, dim = false }: { s: Workstream; c: Colors; /** An Older row: chips at 60 %, like its glyph. */ dim?: boolean }) {
329
+ const ChipRail = memo(function ChipRail({ s, c, dim = false }: { s: Workstream; c: Colors; /** An Older row: chips at 60 %, like its glyph. */ dim?: boolean }) {
330
+ chipRails++;
320
331
  const chips = railChips(s);
321
332
  if (chips.length === 0) return null;
322
333
  return <View testID="follow-up-row-chips" style={{ ...(dim ? { opacity: 0.6 } : {}), flexShrink: 1000, minWidth: 0, height: 20, overflow: "hidden", flexDirection: "row", flexWrap: "wrap", justifyContent: "flex-end", columnGap: 10, rowGap: 4 }}>
323
334
  {chips.map(ch => ch.kind === "badge" ? <BadgeView key={ch.badge.text} b={ch.badge} c={c} /> : <PrChipView key="pr" s={s} c={c} />)}
324
335
  </View>;
325
- }
336
+ // Show › Pull request off hands the rail a copy without the PR and the same sig, so the PR's presence counts too.
337
+ }, (a, b) => a.s.sig === b.s.sig && !!a.s.pr === !!b.s.pr && a.c === b.c && a.dim === b.dim);
326
338
 
327
339
  /** The age on the right. It re-renders on the shared minute clock without touching its row. */
328
340
  export function Age({ iso, c, size = 12 }: { iso: string | null; c: Colors; size?: number }) {
@@ -362,6 +374,7 @@ export function rowDetail(s: Workstream, view: HomeView, facts: HomeListProps["f
362
374
 
363
375
  type RowProps = { s: Workstream; sig: string; detail?: RowDetail; detailSig?: string; theme: Theme; dense: boolean; touch: boolean; selected: boolean; onSelect: (key: string) => void; onOpen?: (key: string) => void; onMenu: OpenRowMenu; menuOpen?: boolean; hit?: RowHit | null; onSendNow?: (s: Workstream) => Promise<void>; selectedBg?: string };
364
376
  const Row = memo(function Row({ s: raw, theme, dense, touch, selected, onSelect, onOpen, onMenu, menuOpen = false, hit = null, onSendNow, selectedBg, detail }: RowProps) {
377
+ rowDraws++;
365
378
  // Title › Branch name swaps the row's title; everything else reads the workstream as built.
366
379
  const s = detail && detail.title !== raw.title ? { ...raw, title: detail.title } : raw;
367
380
  const showTime = detail?.time ?? true;
@@ -454,7 +467,7 @@ const Row = memo(function Row({ s: raw, theme, dense, touch, selected, onSelect,
454
467
  </View>{!!why && <View style={{ paddingRight: 40 }}><PriorityLine reason={why.reason} source={why.source} c={c} /></View>}</View>}
455
468
  {!touch && !dense && showTime && <RowTime s={s} c={c} size={12} />}
456
469
  </Pressable>;
457
- }, (a, b) => a.sig === b.sig && a.selected === b.selected && a.theme === b.theme && a.dense === b.dense && a.touch === b.touch && a.onSelect === b.onSelect && a.onOpen === b.onOpen && a.onMenu === b.onMenu && a.menuOpen === b.menuOpen && a.hit === b.hit && a.onSendNow === b.onSendNow && a.selectedBg === b.selectedBg && a.detailSig === b.detailSig);
470
+ }, (a, b) => a.sig === b.sig && a.selected === b.selected && a.theme === b.theme && a.dense === b.dense && a.touch === b.touch && a.onSelect === b.onSelect && a.onOpen === b.onOpen && a.onMenu === b.onMenu && a.menuOpen === b.menuOpen && sameHit(a.hit, b.hit) && a.onSendNow === b.onSendNow && a.selectedBg === b.selectedBg && a.detailSig === b.detailSig);
458
471
 
459
472
  /**
460
473
  * Paseo's detail line under a row: branch, project, the PR with its checks, labels (as Display › Show leaves them),
@@ -1,8 +1,9 @@
1
1
  import type { DispatchRecord } from "../shared/dispatch";
2
2
  import type { PluginClientContext } from "@getpaseo/plugin/client";
3
3
  import type { ImageUpload } from "../shared/images";
4
- import { contextAskRpc, contextListRpc, questionActionRpc, dispatchRecordsRpc, displayFeed, homeFeed, queueNeedsSchema, overseerAskRpc, overseerRestartRpc, overseerStartRpc, overseerStatusRpc, prioritiesRpc, prStatsSettingsRpc, rankNowRpc, rankStatusRpc, usageRpc } from "../shared/contracts";
4
+ import { contextAskRpc, contextListRpc, questionActionRpc, dispatchRecordsRpc, homeFeed, queueNeedsSchema, overseerAskRpc, overseerRestartRpc, overseerStartRpc, overseerStatusRpc, prioritiesRpc, prStatsSettingsRpc, rankNowRpc, rankStatusRpc, usageRpc } from "../shared/contracts";
5
5
  import { openFeed } from "./feeds";
6
+ import { followDisplayDoc } from "./display";
6
7
  import { sharedRead, USAGE_SHARED_MS } from "./shared-read";
7
8
  import type { RpcInput, RpcOutput } from "@getpaseo/plugin";
8
9
  import type { Priority } from "../shared/priorities";
@@ -162,12 +163,10 @@ export function createHomeExtras(client: PluginClientContext) {
162
163
  down: () => { if (usagePolls) { usagePolls(); usagePolls = null; } homePolls ??= pollHome(); },
163
164
  up: () => { homePolls?.(); homePolls = null; },
164
165
  });
165
- const display = home ? openFeed(client, displayFeed, {}, {
166
- event: doc => { if (!stopped) void sync.apply(doc).then(changed => { if (changed) emit(); }); },
167
- down: () => { sortPolls ??= pollSort(); },
168
- up: () => { sortPolls?.(); sortPolls = null; },
169
- }) : null;
170
- const stopFeeds = () => { home?.stop(); display?.stop(); for (const off of [homePolls, sortPolls, usagePolls]) off?.(); homePolls = sortPolls = usagePolls = null; };
166
+ // The Display document comes from the Display store's feed (client/display.tsx), which reads it while that feed is
167
+ // down: one follow.display-feed per client (invariant 142).
168
+ const display = home ? followDisplayDoc(doc => { if (!stopped) void sync.apply(doc).then(changed => { if (changed) emit(); }); }) : null;
169
+ const stopFeeds = () => { home?.stop(); display?.(); for (const off of [homePolls, sortPolls, usagePolls]) off?.(); homePolls = sortPolls = usagePolls = null; };
171
170
  if (home) {
172
171
  // The Display feed's first event is the document (ValueFeed sends the current value first), so the order and the
173
172
  // old-choice migration apply from it (sync.apply): no read of its own at open (one-read-per-key-at-mount).
package/client/panel.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import { finishedTask } from "../shared/finished";
2
- import { createContext, useContext, useEffect, useRef, useState, type ReactNode } from "react";
2
+ import { createContext, useCallback, useContext, useEffect, useRef, useState, type ReactNode } from "react";
3
3
  import { PagedRows } from "./paged-list";
4
4
  import type { SettingsCategory } from "../shared/settings-nav";
5
5
  import { recoveryActions } from "./recovery-actions";
@@ -373,6 +373,26 @@ function Slot({ id, onHeight, children }: { id: string; onHeight: (id: string, h
373
373
  return <View onLayout={e => onHeight(id, Math.round(e.nativeEvent.layout.height))}>{children}</View>;
374
374
  }
375
375
 
376
+ type PanelCard = { key: string; node: ReactNode; column?: number };
377
+ /**
378
+ * The cards in columns, placed from their measured heights (invariant 149, a-card-resize-redraws-no-other-card). The
379
+ * heights live here, not in WorkspaceView: a card that grows or shrinks (a question picked or closed in Needs you)
380
+ * redraws these columns alone, and every card in them is the same element as before, so React skips it.
381
+ */
382
+ function Columns({ cards, columns }: { cards: readonly PanelCard[]; columns: number }) {
383
+ // Measured heights and the last placement (so a card whose height changes with its column doesn't flip back and forth).
384
+ const [heights, setHeights] = useState<Record<string, number>>({});
385
+ const placed = useRef<Record<string, number>>({});
386
+ const onHeight = useCallback((id: string, h: number) => setHeights(prev => prev[id] === h ? prev : { ...prev, [id]: h }), []);
387
+ const where = placeCards(cards, columns, heights, placed.current);
388
+ placed.current = where;
389
+ return <View style={{ flexDirection: "row", alignItems: "flex-start" }}>
390
+ {Array.from({ length: columns }, (_, col) => <View key={col} style={{ flex: columns === 2 ? (col === 0 ? AGENT_SHARE : 1 - AGENT_SHARE) : 1, minWidth: 0 }}>
391
+ {cards.filter(x => where[x.key] === col).map(x => <Slot key={x.key} id={x.key} onHeight={onHeight}>{x.node}</Slot>)}
392
+ </View>)}
393
+ </View>;
394
+ }
395
+
376
396
  /** A pending permission of one agent in the workspace, with Allow and Deny, in Needs you (`permissions`). */
377
397
  function AgentPermissions({ agentId, theme, compact }: { agentId: string; theme: Theme; compact: boolean }) {
378
398
  const agent = useAgentLive(agentId);
@@ -439,7 +459,9 @@ export function WorkspaceView({ theme, layout, workspace: w, navigation, loadErr
439
459
  const invalidated = () => { void cache.invalidateQueries({ queryKey: workspaceKey(w.id) }); void cache.invalidateQueries({ queryKey: overviewKey }); };
440
460
  const auto = useMutation({ mutationFn: (next: boolean) => control({ workspaceId: w.id, enable_auto_sends: next }), onSuccess: (_, next) => { toast.show(next ? "Auto-send on for this workspace" : "Auto-send off · repairs wait for your Send"); invalidated(); }, onError: e => toast.error(errorText(e)) });
441
461
  // Opening a workspace reads its PRs now: background polling backs off for settled repositories (server/github.ts).
442
- useEffect(() => { const t = setTimeout(invalidated, 1500); void refresh({ workspaceId: w.id }).catch(() => undefined); return () => clearTimeout(t); }, [w.id]); // eslint-disable-line react-hooks/exhaustive-deps
462
+ // Nothing reads the workspace again after it (invariant 150): a change it finds moves the list copy's updatedAt, which
463
+ // re-reads once (useWorkspace), and its read stamps reach the "Checked" line through the feed.
464
+ useEffect(() => { void refresh({ workspaceId: w.id }).catch(() => undefined); }, [w.id]); // eslint-disable-line react-hooks/exhaustive-deps
443
465
  const update = useMutation({ mutationFn: () => refresh({ workspaceId: w.id }), onSuccess: () => setTimeout(invalidated, 1200), onError: e => toast.error(errorText(e)) });
444
466
  const openAgent = navigation ? (agentId: string) => navigation.openAgent({ agentId }) : undefined;
445
467
  const done = summary(w, now).status === "done";
@@ -481,10 +503,6 @@ export function WorkspaceView({ theme, layout, workspace: w, navigation, loadErr
481
503
  const workspaceCard = <WorkspaceCard workspace={w} theme={theme} compact={compact} openAgent={openAgent} browserReady={browser.data ? browser.data.ready : null} openOverview={openOverview} editSpec={() => setSpecOpen(true)} />;
482
504
  // Home is a screen, with no client state (useAgent throws there): agent titles read the short id.
483
505
  const extras = place === "home" ? <AgentTitleSource.Provider value={noClientState}>{workspaceCard}</AgentTitleSource.Provider> : workspaceCard;
484
- // Measured heights and the last placement (so a card whose height changes with its column doesn't flip back and forth).
485
- const [heights, setHeights] = useState<Record<string, number>>({});
486
- const placed = useRef<Record<string, number>>({});
487
- const onHeight = (id: string, h: number) => setHeights(prev => prev[id] === h ? prev : { ...prev, [id]: h });
488
506
  // Priority order. The left column (the wide one in two) is the agent's, or Needs you's while anything waits on the
489
507
  // developer: it reads first, as in one column, and the agent card moves to the next column. In two columns the
490
508
  // decisions and PRs stay right and the record joins the shorter column; in three every other card goes to the
@@ -492,26 +510,19 @@ export function WorkspaceView({ theme, layout, workspace: w, navigation, loadErr
492
510
  const waiting = needsYou(w, now).length > 0 || !!permissions || !!ask?.card;
493
511
  const right = lay.columns === 2 ? 1 : undefined;
494
512
  const agentCol = waiting ? 1 : 0;
495
- const cards: { key: string; node: ReactNode; column?: number }[] = [
513
+ const cards: PanelCard[] = [
496
514
  { key: "shipped", node: shipped, column: 0 }, ...(waiting ? [{ key: "needs", node: needs, column: 0 }] : []),
497
515
  { key: "agent", node: agentCard, column: agentCol }, { key: "messages", node: messages, column: agentCol }, { key: "history", node: history, column: agentCol },
498
516
  ...(waiting ? [] : [{ key: "needs", node: needs, column: right }]), { key: "questions", node: questions, column: right }, { key: "stacks", node: stacks, column: right },
499
517
  { key: "tasks", node: tasks, column: right }, { key: "log", node: log }, { key: "extras", node: extras },
500
518
  ].filter(x => !!x.node);
501
- const where = placeCards(cards, lay.columns, heights, placed.current);
502
- placed.current = where;
503
519
  const one = <>{shipped}{needs}{agentCard}{messages}{questions}{history}{stacks}{tasks}{log}{extras}</>;
504
- const columns = multi && <View style={{ flexDirection: "row", alignItems: "flex-start" }}>
505
- {Array.from({ length: lay.columns }, (_, col) => <View key={col} style={{ flex: lay.columns === 2 ? (col === 0 ? AGENT_SHARE : 1 - AGENT_SHARE) : 1, minWidth: 0 }}>
506
- {cards.filter(x => where[x.key] === col).map(x => <Slot key={x.key} id={x.key} onHeight={onHeight}>{x.node}</Slot>)}
507
- </View>)}
508
- </View>;
509
520
  return <View testID={`follow-up-view-${place}`} onLayout={event => setWidth(event.nativeEvent.layout.width)} style={{ flex: 1, backgroundColor: theme.colors.surface0 }}>
510
521
  {/* Agent rows peek at their agent's turn on hover (client/turn-view.tsx), where Recent steps start folded. */}
511
522
  <PeekHost where={place === "panel" ? "panel" : "main"} theme={theme} compact={compact} openAgent={openAgent} names={agentName} enabled={place === "panel"}>
512
523
  <DockedPane compact={compact} scrollRef={scrollRef as never} header={!compact || place !== "panel" ? top : undefined} dock={dock} style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 20 }}>
513
524
  {header}
514
- {multi ? columns : one}
525
+ {multi ? <Columns cards={cards} columns={lay.columns} /> : one}
515
526
  </DockedPane>
516
527
  </PeekHost>
517
528
  <PrSheet workspace={w} prKey={sheet?.key ?? null} intent={sheet?.intent ?? null} theme={theme} compact={compact} browserReady={browser.data?.ready ?? false} onClose={() => setSheet(null)} />
@@ -30,8 +30,9 @@ export function useReviewerSettings() {
30
30
  const noReview = query.data.noReview ?? [];
31
31
  if (JSON.stringify(query.data.config) === JSON.stringify(reviewerConfig()) && JSON.stringify([...noReview].sort()) === JSON.stringify(noReviewRepoList())) return;
32
32
  setReviewerConfig(query.data.config); setNoReviewRepos(noReview);
33
- // Needs-you rows and counts were computed with the previous lists.
34
- void cache.invalidateQueries({ queryKey: ["follow-up", "workspace"] }); void cache.invalidateQueries({ queryKey: ["follow-up", "overview"] });
33
+ // Needs-you rows and counts were computed with the previous lists: every open workspace redraws from the copy it
34
+ // already read (useWorkspace follows both lists), never a read of it again (invariant 150).
35
+ void cache.invalidateQueries({ queryKey: ["follow-up", "overview"] });
35
36
  }, [query.data]);
36
37
  return query;
37
38
  }
@@ -14,7 +14,7 @@ import { isLoaded, type LoadSignals } from "../shared/agent-load";
14
14
  import { errorText } from "../shared/errors";
15
15
  import { since } from "../shared/now";
16
16
  import { fitTurn, foldTurn, runLabel, runSteps, turnSource, type Turn, type TurnItem, type TurnRow, type TurnSource, type TurnStep } from "../shared/turn";
17
- import { PEEK_CLOSED, peekDeadline, peekStep, timelineOnScreen, type PeekEvent } from "../shared/peek";
17
+ import { PEEK_CLOSED, peekStep, peekWait, pointerWhere, timelineOnScreen, type PeekEvent } from "../shared/peek";
18
18
 
19
19
  /**
20
20
  * The agent's current turn, drawn the way its chat draws it (Chat Polish's look; shared/turn.ts says what is copied).
@@ -230,6 +230,8 @@ function DesktopFooter({ s, startedAt, asking, theme, onOpen }: { s: TurnState;
230
230
  </View>;
231
231
  }
232
232
 
233
+ /** How often an open peek re-checks a pointer at rest (the layout can move the line or the peek away from it). */
234
+ const POINTER_LOOK_MS = 400;
233
235
  /** The peek's timers run on a monotonic clock: wall time can jump (or, in the harness, be frozen). */
234
236
  const clock = () => (globalThis as { performance?: { now(): number } }).performance?.now() ?? Date.now();
235
237
 
@@ -305,11 +307,21 @@ export function PeekHost({ where, theme, compact, openAgent, names, chatBeside =
305
307
  dispatch({ type: "close" });
306
308
  if (within && id) (nodes.current.get(id)?.() as { focus?(): void } | null)?.focus?.();
307
309
  }, []);
308
- // One timer: the next pending open or grace close.
310
+ // One timer: the next pending open or grace close. It ticks only once the deadline has passed on the clock: a timer
311
+ // that fires early (browsers do, by up to ~1 ms) waits again for what is left, since an early tick would change
312
+ // nothing and leave nothing armed (invariant 151).
309
313
  useEffect(() => {
310
- const at = peekDeadline(state);
311
- if (at === null) return;
312
- const id = setTimeout(() => dispatch({ type: "tick", t: clock() }), Math.max(0, at - clock()));
314
+ const first = peekWait(state, clock());
315
+ if (first === null) return;
316
+ let id: ReturnType<typeof setTimeout>;
317
+ const fire = () => {
318
+ const now = clock();
319
+ const wait = peekWait(state, now);
320
+ if (wait === null) return;
321
+ if (wait > 0) { id = setTimeout(fire, wait); return; }
322
+ dispatch({ type: "tick", t: now });
323
+ };
324
+ id = setTimeout(fire, first);
313
325
  return () => clearTimeout(id);
314
326
  }, [state]);
315
327
  // Place it when it opens (or another line takes over).
@@ -334,6 +346,50 @@ export function PeekHost({ where, theme, compact, openAgent, names, chatBeside =
334
346
  doc?.addEventListener("pointerdown", down, true); doc?.addEventListener("scroll", scroll, true);
335
347
  return () => { doc?.removeEventListener("pointerdown", down, true); doc?.removeEventListener("scroll", scroll, true); };
336
348
  }, [state.open]);
349
+ // Where the pointer is, read from the document while a peek is open or arming (invariant 151,
350
+ // an-open-peek-closes-when-the-pointer-is-away): a hover event the line or the peek misses (a node replaced under
351
+ // the pointer, React Native Web's nested-Pressable hover lock) must not keep it open, so the peek never waits on one
352
+ // leave event. Each move is hit-tested against the open line, the arming line and the peek (at most once a
353
+ // frame), and again every POINTER_LOOK_MS for a pointer at rest while the layout moves. Focus on the line or in the
354
+ // peek holds it (keyboard entry): there the pointer decides nothing.
355
+ const pendingId = state.pending?.id ?? null;
356
+ useEffect(() => {
357
+ if ((!state.open && !pendingId) || Platform.OS !== "web") return;
358
+ type Listen = { addEventListener(t: string, f: (e: PointerLike) => void, o?: object): void; removeEventListener(t: string, f: (e: PointerLike) => void, o?: object): void };
359
+ type PointerLike = { clientX: number; clientY: number; pointerType?: string; relatedTarget?: unknown; type: string };
360
+ const g = globalThis as unknown as { document?: Listen & { activeElement?: unknown }; requestAnimationFrame?(f: () => void): number; cancelAnimationFrame?(id: number): void };
361
+ const doc = g.document;
362
+ if (!doc) return;
363
+ const open = state.open;
364
+ let at: { x: number; y: number } | null = null;
365
+ let frame: number | null = null;
366
+ const held = () => {
367
+ const active = doc.activeElement;
368
+ const line = open ? nodes.current.get(open)?.() as { contains?(n: unknown): boolean } | null : null;
369
+ return !!active && (!!(peekRef.current as { contains?(n: unknown): boolean } | null)?.contains?.(active) || !!line?.contains?.(active));
370
+ };
371
+ const box = (node: unknown) => { const r = rectOf(node); return r ? { left: r.left, top: r.top, right: r.right, bottom: r.bottom } : null; };
372
+ const look = () => {
373
+ frame = null;
374
+ if (!at || held()) return;
375
+ dispatch({ type: "pointer", where: pointerWhere(at, { line: open ? box(nodes.current.get(open)?.()) : null, pending: pendingId ? box(nodes.current.get(pendingId)?.()) : null, peek: open ? box(peekRef.current) : null }), t: clock() });
376
+ };
377
+ const move = (e: PointerLike) => {
378
+ if (e.pointerType === "touch") return;
379
+ at = { x: e.clientX, y: e.clientY };
380
+ if (frame === null) frame = g.requestAnimationFrame ? g.requestAnimationFrame(look) : (look(), null);
381
+ };
382
+ // The pointer left the window: away, wherever it was last seen.
383
+ const out = (e: PointerLike) => { if (e.relatedTarget == null && e.pointerType !== "touch" && !held()) { at = null; dispatch({ type: "pointer", where: "away", t: clock() }); } };
384
+ const opts = { capture: true, passive: true };
385
+ doc.addEventListener("pointermove", move, opts); doc.addEventListener("pointerout", out, opts);
386
+ const timer = open ? setInterval(look, POINTER_LOOK_MS) : null;
387
+ return () => {
388
+ doc.removeEventListener("pointermove", move, opts); doc.removeEventListener("pointerout", out, opts);
389
+ if (timer) clearInterval(timer);
390
+ if (frame !== null) g.cancelAnimationFrame?.(frame);
391
+ };
392
+ }, [state.open, pendingId]);
337
393
  // An agent whose turn comes on screen (its row was selected, say) loses its peek: one predicate, also for an open one.
338
394
  const marked = useMarkedOnScreen();
339
395
  const shown = state.open && !timelineOnScreen(state.open, { marked, chatBeside }) ? state.open : null;
@@ -1,4 +1,4 @@
1
- import { useEffect, useMemo, useSyncExternalStore } from "react";
1
+ import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
2
2
  import { useQuery } from "@tanstack/react-query";
3
3
  import { useRpc } from "@getpaseo/plugin/client";
4
4
  import { getRpc } from "../shared/contracts";
@@ -10,6 +10,9 @@ import { workspaceKey } from "./keys";
10
10
  import type { Workspace } from "../shared/model";
11
11
  import { pendingAnswers, pendingKey, settlePendingAnswers, subscribePendingAnswers } from "./pending-answers";
12
12
  import { settledAnswers, withPendingAnswers } from "../shared/optimistic-answers";
13
+ import { newerReadStamps, splitReadStamps } from "../shared/list";
14
+ import { onReviewerConfig, reviewerConfig } from "../shared/reviewers";
15
+ import { noReviewReposVersion, onNoReviewRepos } from "../shared/pr-workflow";
13
16
 
14
17
  const none = () => () => {};
15
18
 
@@ -37,7 +40,8 @@ export function useWorkspace(live: LiveStore | undefined, workspaceId: string, o
37
40
  const enabled = (options.enabled ?? true) && !!workspaceId;
38
41
  const read = useRpc(getRpc);
39
42
  // The list copy only says when to read again: a change listed after this read (updatedAt) re-reads once.
40
- const listedAt = useSyncExternalStore(live?.subscribe ?? none, () => enabled ? live?.get(workspaceId)?.updatedAt ?? null : null, () => null);
43
+ const listed = useSyncExternalStore(live?.subscribe ?? none, () => enabled ? live?.get(workspaceId) ?? null : null, () => null);
44
+ const listedAt = listed?.updatedAt ?? null;
41
45
  const query = useQuery({ queryKey: workspaceKey(workspaceId), queryFn: () => readWorkspace(read, workspaceId), enabled, staleTime: 15_000, refetchOnWindowFocus: false });
42
46
  const readAt = query.data?.workspace?.updatedAt ?? null;
43
47
  const { refetch, isFetching } = query;
@@ -47,7 +51,22 @@ export function useWorkspace(live: LiveStore | undefined, workspaceId: string, o
47
51
  // answering-is-optimistic: the full copy reads the developer's answers in flight as answered, as the list store does.
48
52
  const pending = useSyncExternalStore(subscribePendingAnswers, pendingAnswers, pendingAnswers);
49
53
  const read$ = enabled ? query.data?.workspace ?? null : null;
50
- const workspace = useMemo(() => read$ && withPendingAnswers(read$, pending, pendingKey), [read$, pending]);
54
+ // Read stamps (when each PR was last checked) come from the list copy, pushed by the feed after a read lands, so a
55
+ // newer check never needs this workspace read again (invariant 150, opening-reads-the-workspace-once).
56
+ const stamps = useMemo(() => listed ? splitReadStamps(listed).stamps : null, [listed]);
57
+ const base = useMemo(() => read$ && newerReadStamps(withPendingAnswers(read$, pending, pendingKey), stamps), [read$, pending, stamps]);
58
+ // Needs you is computed with the reviewer lists (shared/reviewers.ts, shared/pr-workflow.ts): when they change, the
59
+ // copy already read is drawn again as a new object, so what was memoised on it is computed again, with no read.
60
+ // Anything else keeps the object (a list push with no newer stamp redraws nothing).
61
+ const reviewers = useSyncExternalStore(onReviewerConfig, reviewerConfig, reviewerConfig);
62
+ const noReview = useSyncExternalStore(onNoReviewRepos, noReviewReposVersion, noReviewReposVersion);
63
+ const drawn = useRef<{ base: Workspace | null; reviewers: unknown; noReview: unknown; out: Workspace | null } | null>(null);
64
+ const workspace = useMemo(() => {
65
+ const last = drawn.current;
66
+ const out = !base || !last || last.base !== base ? base : last.reviewers !== reviewers || last.noReview !== noReview ? { ...base } : last.out;
67
+ drawn.current = { base, reviewers, noReview, out };
68
+ return out;
69
+ }, [base, reviewers, noReview]);
51
70
  return {
52
71
  workspace,
53
72
  /** Why there is no workspace to show: the read failed or found none (null while reading, or when disabled). */
package/index.server.ts CHANGED
@@ -205,7 +205,7 @@ export default function contribute(server: PluginServerContext) {
205
205
  };
206
206
  // What each subscription feed is made of may have changed (wired to the feeds below, server/feeds.ts). Cheap: a feed
207
207
  // with no subscriber does nothing, and an unchanged value pushes nothing.
208
- const feeds = { workspaces: () => {}, inbox: () => {}, home: () => {} };
208
+ const feeds = { workspaces: () => {}, inbox: () => {}, home: () => {}, readsNow: () => {} };
209
209
  const noteMainWork = async (agentId: string) => {
210
210
  // A cheap check on the snapshot first: almost every call has no open handover, so nothing is written.
211
211
  if (!(await store.snapshot()).workspaces.some(w => mainWorkDue(w, agentId, Date.now()))) return;
@@ -1051,7 +1051,8 @@ export default function contribute(server: PluginServerContext) {
1051
1051
  await requireReady();
1052
1052
  // While GitHub is off, Refresh checks it again first (one gh check, on the click), so turning it on shows at once.
1053
1053
  const recheck = githubSetup().off() ? githubSetup().check().then(() => undefined, () => undefined) : Promise.resolve();
1054
- void recheck.then(() => engine.tick({ workspaceId }));
1054
+ // Its read stamps go out when the tick lands, not a feed window later: the open view reads no workspace again for them.
1055
+ void recheck.then(() => engine.tick({ workspaceId })).then(() => feeds.readsNow(), () => undefined);
1055
1056
  return { ok: true };
1056
1057
  });
1057
1058
  handle(rpc.refineTasksRpc, async ({ workspaceId, tasks }) => {
@@ -2060,6 +2061,7 @@ export default function contribute(server: PluginServerContext) {
2060
2061
  });
2061
2062
  const displayFeed = new ValueFeed({ read: () => displaySettings.read() });
2062
2063
  feeds.workspaces = () => void workspacesFeed.changed();
2064
+ feeds.readsNow = () => void workspacesFeed.changed({ readsNow: true });
2063
2065
  feeds.inbox = () => void inboxFeed.changed();
2064
2066
  feeds.home = () => void homeFeed.changed();
2065
2067
  // The daytime read runs only while an app client is open (the-brief-has-one-timer): a subscriber on the home feed,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paseo-follow-up",
3
3
  "private": false,
4
- "version": "2.6.0-beta.4",
4
+ "version": "2.6.0-beta.5",
5
5
  "description": "Every agent, one inbox. Follow-up brings what all your coding agents need from you into one ranked list, and follows their work through merge, deploy and after.",
6
6
  "type": "module",
7
7
  "files": [
package/server/feeds.ts CHANGED
@@ -64,12 +64,16 @@ export type WorkspacesEvent = { revision: number; full: boolean; workspaces: Lis
64
64
  * Read stamps never count (invariant 140): a change that moved only read stamps (ListCache's `stampsOnly`) goes to a
65
65
  * subscriber at most once per READS_PUSH_MS. A held one isn't lost: the subscriber keeps its revision, so its next push
66
66
  * (the next change after the window, with or without new entries) carries every stamp that moved since. No timer: the
67
- * worker's own ticks call `changed()`.
67
+ * worker's own ticks call `changed()`. A read the developer asked for (follow.refresh, also what opening a workspace
68
+ * sends) passes `readsNow`, so its stamps arrive when it lands: the open view's "Checked" line moves without a re-read
69
+ * of the workspace (invariant 150).
68
70
  */
69
71
  export class WorkspacesFeed {
70
72
  private subs = new Set<{ push: Push<WorkspacesEvent>; revision: number | undefined; error: string | null; readsAt: number }>();
71
73
  private reading: Promise<void> | null = null;
72
74
  private again = false;
75
+ /** The next pass sends held read stamps at once: a read the developer asked for (follow.refresh) shows when it lands. */
76
+ private readsNow = false;
73
77
  constructor(private cache: ListCache, private state: () => Promise<State>, private error: () => string | null, private now: () => number = Date.now) {}
74
78
  get size() { return this.subs.size; }
75
79
 
@@ -86,12 +90,14 @@ export class WorkspacesFeed {
86
90
  }).catch(() => undefined);
87
91
  }
88
92
 
89
- changed(): Promise<void> {
90
- if (!this.subs.size) return Promise.resolve();
93
+ changed(opts: { readsNow?: boolean } = {}): Promise<void> {
94
+ if (opts.readsNow) this.readsNow = true;
95
+ if (!this.subs.size) { this.readsNow = false; return Promise.resolve(); }
91
96
  if (this.reading) { this.again = true; return this.reading; }
92
97
  this.reading = (async () => {
93
98
  do {
94
99
  this.again = false;
100
+ const readsNow = this.readsNow; this.readsNow = false;
95
101
  const state = await this.state();
96
102
  const error = this.error();
97
103
  const answers = new Map<number | undefined, ReturnType<ListCache["answer"]>>();
@@ -101,7 +107,7 @@ export class WorkspacesFeed {
101
107
  const empty = !answer.full && !answer.workspaces.length && !answer.removed.length && !Object.keys(answer.reads).length;
102
108
  if (empty && sub.error === error) { sub.revision = answer.revision; return undefined; }
103
109
  // Only read stamps moved: hold them (keeping the revision) until the window is up.
104
- if (answer.stampsOnly && sub.error === error && this.now() - sub.readsAt < READS_PUSH_MS) return undefined;
110
+ if (answer.stampsOnly && !readsNow && sub.error === error && this.now() - sub.readsAt < READS_PUSH_MS) return undefined;
105
111
  sub.revision = answer.revision; sub.error = error;
106
112
  if (Object.keys(answer.reads).length) sub.readsAt = this.now();
107
113
  const { stampsOnly: _s, ...event } = answer;
package/server/github.ts CHANGED
@@ -28,7 +28,12 @@ export function repoMerge(repository: Node): NonNullable<Snapshot["repoMerge"]>
28
28
 
29
29
  export function parsePr(pr: Node, trunk: string, observedAt: string, required: string[]): Snapshot {
30
30
  const threads = pr.reviewThreads;
31
- const contexts = pr.commits.nodes[0]?.commit.statusCheckRollup?.contexts;
31
+ // The head comes from headRefOid, the checks from the PR's last listed commit: two fields GitHub updates apart. After
32
+ // a push the commit list can still end at the old head, whose results then read as the new head's
33
+ // (checks-belong-to-the-current-head). Results for any other commit count as nothing reported on the head yet.
34
+ const checksHead: string | null = pr.commits.nodes[0]?.commit.oid ?? null;
35
+ const foreign = !!checksHead && checksHead !== pr.headRefOid;
36
+ const contexts = foreign ? undefined : pr.commits.nodes[0]?.commit.statusCheckRollup?.contexts;
32
37
  const failed = new Set(["FAILURE", "ERROR", "TIMED_OUT", "CANCELLED", "ACTION_REQUIRED", "STARTUP_FAILURE"]);
33
38
  const requiredSet = new Set(required);
34
39
  const checks = contexts?.nodes ?? [];
@@ -37,9 +42,11 @@ export function parsePr(pr: Node, trunk: string, observedAt: string, required: s
37
42
  const otherFailedChecks: string[] = [];
38
43
  let checksPending = false;
39
44
  let checksRunning = false;
45
+ let checksSeen = 0;
40
46
  for (const c of checks) {
41
47
  const name = c.name ?? c.context;
42
48
  const conclusion = c.conclusion ?? c.state;
49
+ if (!["SKIPPED", "NEUTRAL"].includes(conclusion)) checksSeen++;
43
50
  if ((c.status && c.status !== "COMPLETED") || (!c.status && ["PENDING", "EXPECTED"].includes(conclusion))) checksRunning = true;
44
51
  if (!requiredSet.has(name)) {
45
52
  if ((!c.status || c.status === "COMPLETED") && failed.has(conclusion)) otherFailedChecks.push(name);
@@ -50,6 +57,7 @@ export function parsePr(pr: Node, trunk: string, observedAt: string, required: s
50
57
  else if (failed.has(conclusion)) failedChecks.push(name);
51
58
  }
52
59
  if ([...requiredSet].some(name => !seen.has(name))) checksPending = true;
60
+ if (foreign) { checksPending = true; checksRunning = true; }
53
61
  return {
54
62
  title: pr.title, url: pr.url, state: pr.state, head: pr.headRefOid, mergeCommit: pr.mergeCommit?.oid ?? null, mergedAt: pr.mergedAt ?? null, headBranch: pr.headRefName ?? "", base: pr.baseRefName, graphiteMergeStatus: null,
55
63
  trunk, draft: pr.isDraft, conflict: pr.mergeable === "CONFLICTING" || pr.mergeStateStatus === "DIRTY",
@@ -63,7 +71,7 @@ export function parsePr(pr: Node, trunk: string, observedAt: string, required: s
63
71
  },
64
72
  mergeWhenReady: "unknown",
65
73
  threads: threads.nodes.filter((t: Node) => !t.isResolved).map((t: Node) => ({ id: t.id, updatedAt: t.comments.nodes[0]?.updatedAt ?? observedAt })),
66
- failedChecks, otherFailedChecks, checksPending, checksRunning,
74
+ failedChecks, otherFailedChecks, checksPending, checksRunning, ...(checksHead ? { checksHead } : {}), checksSeen,
67
75
  complete: !threads.pageInfo.hasNextPage && !contexts?.pageInfo.hasNextPage && (pr.state !== "OPEN" || pr.mergeable !== "UNKNOWN"), observedAt,
68
76
  ...(typeof pr.mergeStateStatus === "string" ? { mergeStateStatus: pr.mergeStateStatus } : {}),
69
77
  ...(typeof pr.isInMergeQueue === "boolean" ? { inMergeQueue: pr.isInMergeQueue } : {}),
@@ -78,7 +86,7 @@ const COUNTS = "checkRunCountsByState{state count} statusContextCountsByState{st
78
86
  */
79
87
  const PROBE = `updatedAt state headRefOid baseRefName isDraft mergeable mergeStateStatus reviewDecision isInMergeQueue autoMergeRequest{enabledAt}
80
88
  reviewThreads(first:100){pageInfo{hasNextPage} nodes{id isResolved}}
81
- commits(last:1){nodes{commit{statusCheckRollup{contexts(first:1){${COUNTS}}}}}}`;
89
+ commits(last:1){nodes{commit{oid statusCheckRollup{contexts(first:1){${COUNTS}}}}}}`;
82
90
  /** PRs per probe query (one account, any number of its repositories): ~300 requests, about 3 points. */
83
91
  const PROBE_CHUNK = 100;
84
92
  const RUNNING_STATES = new Set(["QUEUED", "IN_PROGRESS", "PENDING", "WAITING", "REQUESTED", "EXPECTED"]);
@@ -98,8 +106,11 @@ export function fingerprint(pr: Node): Fingerprint | null {
98
106
  ].filter(([, n]) => n > 0).sort(([a], [b]) => a.localeCompare(b));
99
107
  const sum = (states: Set<string>) => counts.reduce((total, [key, n]) => total + (states.has(key.slice(key.indexOf(":") + 1)) ? n : 0), 0);
100
108
  const unresolved = threads.nodes.filter((t: Node) => !t.isResolved).map((t: Node) => String(t.id)).sort();
109
+ // The rollup's commit (checks-belong-to-the-current-head): a lagged commit list catching up to the head is a change
110
+ // even when its counts read the same.
111
+ const checksHead = pr.commits?.nodes?.[0]?.commit?.oid ?? null;
101
112
  return {
102
- core: JSON.stringify([pr.updatedAt, pr.state, pr.headRefOid, pr.baseRefName, !!pr.isDraft, pr.mergeable ?? null, pr.mergeStateStatus ?? null, pr.reviewDecision ?? null, pr.isInMergeQueue ?? null, !!pr.autoMergeRequest, unresolved]),
113
+ core: JSON.stringify([pr.updatedAt, pr.state, pr.headRefOid, ...(checksHead ? [checksHead] : []), pr.baseRefName, !!pr.isDraft, pr.mergeable ?? null, pr.mergeStateStatus ?? null, pr.reviewDecision ?? null, pr.isInMergeQueue ?? null, !!pr.autoMergeRequest, unresolved]),
103
114
  checks: JSON.stringify(counts), running: sum(RUNNING_STATES), failed: sum(FAILED_STATES),
104
115
  };
105
116
  }
@@ -112,7 +123,7 @@ reviewRequests(first:100){pageInfo{hasNextPage} nodes{requestedReviewer{__typena
112
123
  latestReviews(first:100){pageInfo{hasNextPage} nodes{state author{__typename login}}}
113
124
  baseRef{branchProtectionRule{requiredStatusCheckContexts} ${RULES} associatedPullRequests(first:100,states:[OPEN]){nodes{number headRefName state headRepository{nameWithOwner}}}}
114
125
  reviewThreads(first:100){pageInfo{hasNextPage} nodes{id isResolved comments(last:1){nodes{updatedAt}}}}
115
- commits(last:1){nodes{commit{statusCheckRollup{contexts(first:100){${COUNTS} pageInfo{hasNextPage} nodes{
126
+ commits(last:1){nodes{commit{oid statusCheckRollup{contexts(first:100){${COUNTS} pageInfo{hasNextPage} nodes{
116
127
  ...on CheckRun{name status conclusion} ...on StatusContext{context state}
117
128
  }}}}}}`;
118
129
 
@@ -339,6 +350,9 @@ export class Github {
339
350
  const reread = (p: Pr) => full.set(p.repo, [...(full.get(p.repo) ?? []), p]);
340
351
  try {
341
352
  this.stats.graphql++; this.stats.probes++;
353
+ // A read counts from when it was asked, never answered: an answer that lands after an agent's push and wait
354
+ // may describe the PR before the push (checks-belong-to-the-current-head).
355
+ const askedAt = new Date(this.now()).toISOString();
342
356
  const payload = await this.api.graphql(byRepo[0], query, {});
343
357
  if (((payload.errors ?? []) as Node[]).some(e => e.type === "RATE_LIMITED" || e.type === "RATE_LIMIT")) throw Object.assign(new Error("rate limited"), { rateLimited: true });
344
358
  this.noteBudget(owner, payload.data?.rateLimit);
@@ -349,7 +363,7 @@ export class Github {
349
363
  if (!seen || probeVerdict(before, seen, this.now() - (this.fullAt.get(p.key) ?? 0)) === "read") { reread(p); continue; }
350
364
  // Nothing the full read decides on moved: the last observation is current as of now.
351
365
  this.stats.unchanged++; this.readAt.set(p.key, this.now());
352
- result.set(p.key, { snapshot: { ...this.last.get(p.key)!.snapshot!, observedAt: new Date(this.now()).toISOString() }, error: null });
366
+ result.set(p.key, { snapshot: { ...this.last.get(p.key)!.snapshot!, observedAt: askedAt }, error: null });
353
367
  }
354
368
  } catch (error) {
355
369
  if (rateLimited(error)) { this.outOfBudget(owner, error); for (const p of chunk) result.set(p.key, this.standIn(p, owner)); continue; }
@@ -368,6 +382,7 @@ export class Github {
368
382
  const query = `query($owner:String!,$name:String!){rateLimit{cost remaining resetAt limit} repository(owner:$owner,name:$name){defaultBranchRef{name branchProtectionRule{requiredStatusCheckContexts} ${RULES}} squashMergeAllowed mergeCommitAllowed rebaseMergeAllowed autoMergeAllowed viewerDefaultMergeMethod mergeQueue{id} ${group.map((p, i) => `p${i}:pullRequest(number:${p.number}){${fields}}`).join(" ")}}}`;
369
383
  try {
370
384
  this.stats.graphql++;
385
+ const askedAt = new Date(this.now()).toISOString(); // asked, not answered (checks-belong-to-the-current-head)
371
386
  const payload = await this.api.graphql(repo, query, { owner, name });
372
387
  this.noteBudget(owner, payload.data?.rateLimit);
373
388
  for (const p of group) this.readAt.set(p.key, this.now());
@@ -404,7 +419,7 @@ export class Github {
404
419
  // branch must not erase the required checks that apply to the stack.
405
420
  const trunkChecks = open && stacked(data) ? [...(repository.defaultBranchRef.branchProtectionRule?.requiredStatusCheckContexts ?? []), ...await rulesFor(trunk, trunkRules)] : [];
406
421
  const required = [...new Set([...(data.baseRef?.branchProtectionRule?.requiredStatusCheckContexts ?? []), ...base, ...trunkChecks])];
407
- const snapshot = parsePr(data, trunk, new Date(this.now()).toISOString(), required);
422
+ const snapshot = parsePr(data, trunk, askedAt, required);
408
423
  const print = fingerprint(data);
409
424
  if (print) this.fingerprints.set(p.key, print); else this.fingerprints.delete(p.key);
410
425
  this.fullAt.set(p.key, this.now());
@@ -16,6 +16,14 @@ export const WATCH_MAX_MS = 12 * 60 * 60_000;
16
16
  * can list a head with no check suites yet, which reads as "nothing running" for a few seconds.
17
17
  */
18
18
  export const WATCH_SETTLE_MS = 60_000;
19
+ /**
20
+ * A head with no check that counts (`checksSeen` 0; a skipped review bot doesn't count) is "nothing ran" only after it
21
+ * has been quiet this long (checks-belong-to-the-current-head). 2026-11-28, example/app#375: the Actions run was
22
+ * created 88 s after the push, past WATCH_SETTLE_MS, so the empty head read "all checks passed". Actions can queue a run
23
+ * for minutes under load or a concurrency group; 10 min is far past that, and the only cost is a repository with no CI
24
+ * hearing "no checks ran" 10 min after its push, from reads the watch already makes (a probe ~ 1/33 point).
25
+ */
26
+ export const WATCH_NO_CHECKS_MS = 10 * 60_000;
19
27
  /** At most this many open watches per agent: a watch per PR of the biggest stack fits (pr-scale-lists-batch-not-throw); this only stops a runaway loop. */
20
28
  export const WATCHES_PER_AGENT = SCALE.perWorkspace;
21
29
 
@@ -41,7 +49,7 @@ export type WatchedPr = {
41
49
  key: string; repo: string; number: number; error: string | null;
42
50
  snapshot: {
43
51
  url: string; state: "OPEN" | "MERGED" | "CLOSED"; head: string; conflict: boolean; complete: boolean; observedAt: string;
44
- failedChecks: string[]; otherFailedChecks?: string[]; checksPending: boolean; checksRunning?: boolean;
52
+ failedChecks: string[]; otherFailedChecks?: string[]; checksPending: boolean; checksRunning?: boolean; checksHead?: string | null; checksSeen?: number;
45
53
  } | null;
46
54
  };
47
55
  export type VerdictKind = "passed" | "failed" | "merged" | "closed" | "conflict" | "expired" | "gone";
@@ -52,12 +60,13 @@ const checksUrl = (pr: WatchedPr) => pr.snapshot?.url ? `${pr.snapshot.url.repla
52
60
  export const WATCH_HEADER = "Follow-up checks";
53
61
 
54
62
  /** The message (or the tool's immediate answer) for a verdict: one header line, then what happened and what to do. */
55
- export function verdictText(kind: VerdictKind, pr: WatchedPr, extra: { failed?: string[]; pending?: boolean; running?: boolean } = {}): string {
63
+ export function verdictText(kind: VerdictKind, pr: WatchedPr, extra: { failed?: string[]; pending?: boolean; running?: boolean; none?: boolean } = {}): string {
56
64
  const name = `${pr.repo}#${pr.number}`;
57
65
  const head = short(pr.snapshot?.head);
58
66
  const link = checksUrl(pr);
59
67
  switch (kind) {
60
- case "passed": return `${WATCH_HEADER} ${name}: all checks passed on ${head}.${extra.pending ? " A required check hasn't reported yet, so GitHub may still block the merge." : ""}`;
68
+ case "passed": if (extra.none) return `${WATCH_HEADER} ${name}: no checks ran on ${head} in ${WATCH_NO_CHECKS_MS / 60_000} minutes, so there is nothing to wait for.`;
69
+ return `${WATCH_HEADER} ${name}: all checks passed on ${head}.${extra.pending ? " A required check hasn't reported yet, so GitHub may still block the merge." : ""}`;
61
70
  case "failed": {
62
71
  const failed = extra.failed ?? [];
63
72
  return `${WATCH_HEADER} ${name}: ${failed.length} check${failed.length === 1 ? "" : "s"} failed on ${head}: ${failed.join(", ")}.${extra.running ? " Others are still running." : ""}${link ? ` Details: ${link}` : ""}`;
@@ -76,7 +85,9 @@ export function verdictText(kind: VerdictKind, pr: WatchedPr, extra: { failed?:
76
85
  * an older read may predate the agent's push. Never throws.
77
86
  *
78
87
  * - merged, closed, a merge conflict: at once.
88
+ * - check results read for a commit other than the head (`checksHead`): nothing yet, keep waiting.
79
89
  * - a required check failed: at once (the agent has to fix it whatever else runs); other failures once nothing runs.
90
+ * - no check that counts on the head: "no checks ran", only after WATCH_NO_CHECKS_MS quiet.
80
91
  * - all finished and none failed: "passed", once checks were seen running on this head or the head has been quiet
81
92
  * WATCH_SETTLE_MS (`quietSince`: when the PR's content last changed, or null when unknown).
82
93
  */
@@ -92,11 +103,15 @@ export function watchVerdict(watch: CheckWatch, pr: WatchedPr | undefined, now:
92
103
  if (s.state === "MERGED") return end("merged", pr);
93
104
  if (s.state === "CLOSED") return end("closed", pr);
94
105
  if (s.conflict) return end("conflict", pr);
106
+ // checks-belong-to-the-current-head: results read for another commit say nothing about this head; keep waiting.
107
+ if (s.checksHead && s.checksHead !== s.head) return keep();
95
108
  const running = s.checksRunning ?? s.checksPending;
96
109
  if (s.failedChecks.length) return end("failed", pr, { failed: [...s.failedChecks, ...(s.otherFailedChecks ?? [])], running });
97
110
  if (running) return watch.runningHead === s.head ? keep() : keep({ ...watch, runningHead: s.head });
98
111
  const others = s.otherFailedChecks ?? [];
99
112
  if (others.length) return end("failed", pr, { failed: others });
113
+ // No check on this head yet (just pushed, CI not started): never "passed" on an empty head until the long quiet.
114
+ if (s.checksSeen === 0) return quietSince !== null && now - quietSince >= WATCH_NO_CHECKS_MS ? end("passed", pr, { none: true }) : keep();
100
115
  const settled = watch.runningHead === s.head || quietSince !== null && now - quietSince >= WATCH_SETTLE_MS;
101
116
  return settled ? end("passed", pr, { pending: s.checksPending }) : keep();
102
117
  }
package/shared/list.ts CHANGED
@@ -120,6 +120,25 @@ export function splitReadStamps(entry: ListEntry): { bare: ListEntry; stamps: Re
120
120
  return { bare: stamps ? { ...entry, prs } : entry, stamps };
121
121
  }
122
122
 
123
+ /**
124
+ * A full workspace (follow.get) with the list copy's read stamps where they are newer: the open view's "Checked" line
125
+ * follows the feed's stamps without reading the whole workspace again (invariant 150). Same object when none is newer.
126
+ */
127
+ export function newerReadStamps<W extends { prs: { key: string; snapshot?: { observedAt?: string; deployment?: { observedAt?: string } | null } | null }[] }>(full: W, stamps: ReadStamps | null | undefined): W {
128
+ if (!stamps) return full;
129
+ let moved = false;
130
+ const prs = full.prs.map(p => {
131
+ const st = stamps[p.key]; const s = p.snapshot;
132
+ if (!st || !s) return p;
133
+ const observed = st[0] && (!s.observedAt || st[0] > s.observedAt) ? st[0] : undefined;
134
+ const deployed = s.deployment && st[1] && (!s.deployment.observedAt || st[1] > s.deployment.observedAt) ? st[1] : undefined;
135
+ if (!observed && !deployed) return p;
136
+ moved = true;
137
+ return { ...p, snapshot: { ...s, ...(observed ? { observedAt: observed } : {}), ...(deployed ? { deployment: { ...s.deployment, observedAt: deployed } } : {}) } };
138
+ });
139
+ return moved ? { ...full, prs } : full;
140
+ }
141
+
123
142
  /** The entry with its read stamps back (the client store, before any reader sees it). Unknown keys are ignored. */
124
143
  export function withReadStamps<E extends ListEntry>(entry: E, stamps: ReadStamps | null | undefined): E {
125
144
  if (!stamps || isArchivedEntry(entry)) return entry;
package/shared/model.ts CHANGED
@@ -37,6 +37,16 @@ export const snapshotSchema = z.object({
37
37
  failedChecks: z.array(z.string()), otherFailedChecks: z.array(z.string()).optional(), checksPending: z.boolean(),
38
38
  /** Any check still running, required or not (a non-required one can still fail). Drives polling cadence (shared/poll.ts). */
39
39
  checksRunning: z.boolean().optional(),
40
+ /**
41
+ * The commit the check results were read for (`commits(last:1)`), when GitHub said. Only results for `head` count
42
+ * (checks-belong-to-the-current-head): parsePr reads another commit's results as nothing reported yet.
43
+ */
44
+ checksHead: z.string().nullable().optional(),
45
+ /**
46
+ * Checks that count on the head (`checksHead`): every check run and status except a skipped or neutral one (a review
47
+ * bot that skips). 0 right after a push, before CI has created its runs. Absent on older snapshots.
48
+ */
49
+ checksSeen: z.number().int().nonnegative().optional(),
40
50
  complete: z.boolean(), observedAt: z.string(),
41
51
  mergeCommit: z.string().nullable().optional(), deployment: deploymentSchema.nullable().optional(),
42
52
  mergedAt: z.string().nullable().optional(),
package/shared/peek.ts CHANGED
@@ -13,7 +13,10 @@
13
13
  * - moving into the peek never switches agents: lines crossed on the way only arm a takeover, which needs the same
14
14
  * OPEN_MS rest on that line and is dropped when the pointer reaches the peek or leaves the line;
15
15
  * - once the pointer entered the peek while it shows a permission request, it stays until closed (Esc, a click
16
- * outside, Open chat, an answer) or another line takes over after its OPEN_MS rest.
16
+ * outside, Open chat, an answer) or another line takes over after its OPEN_MS rest;
17
+ * - where the pointer is, read from the document (`pointer`, `pointerWhere`), decides as the enter and leave events
18
+ * do, so an open peek closes once the pointer is outside the line and the peek even when a leave event never
19
+ * arrives (invariant 151, an-open-peek-closes-when-the-pointer-is-away).
17
20
  */
18
21
 
19
22
  export const OPEN_MS = 350;
@@ -46,8 +49,18 @@ export type PeekEvent =
46
49
  | { type: "peekLeave"; t: number }
47
50
  | { type: "asking"; on: boolean; t: number }
48
51
  | { type: "tick"; t: number }
52
+ /** Where the document says the pointer is: over the open line, the line arming a takeover, the peek, or none. */
53
+ | { type: "pointer"; where: PointerWhere; t: number }
49
54
  | { type: "close" };
50
55
 
56
+ export type PointerWhere = "line" | "pending" | "peek" | "away";
57
+ export type Box = { left: number; top: number; right: number; bottom: number };
58
+ /** The peek first (it may overlap the line), then the open line, then the line arming a takeover. */
59
+ export function pointerWhere(p: { x: number; y: number }, b: { line: Box | null; pending: Box | null; peek: Box | null }): PointerWhere {
60
+ const inside = (r: Box | null) => !!r && p.x >= r.left && p.x <= r.right && p.y >= r.top && p.y <= r.bottom;
61
+ return inside(b.peek) ? "peek" : inside(b.line) ? "line" : inside(b.pending) ? "pending" : "away";
62
+ }
63
+
51
64
  const openOn = (id: string): PeekState => ({ ...PEEK_CLOSED, open: id });
52
65
  const grace = (s: PeekState, t: number): PeekState => s.open && !s.inPeek && !s.sticky ? { ...s, closeAt: t + CLOSE_MS } : s;
53
66
 
@@ -74,13 +87,45 @@ export function peekStep(s: PeekState, e: PeekEvent): PeekState {
74
87
  if (s.closeAt !== null && e.t >= s.closeAt) return PEEK_CLOSED;
75
88
  return s;
76
89
  }
90
+ case "pointer":
91
+ return pointerStep(s, e.where, e.t);
77
92
  case "close":
78
93
  return PEEK_CLOSED;
79
94
  }
80
95
  }
81
96
 
97
+ /** The document's pointer, applied idempotently: the same state back when nothing changes (no redraw per move). */
98
+ function pointerStep(s: PeekState, where: PointerWhere, t: number): PeekState {
99
+ if (!s.open && !s.pending) return s;
100
+ switch (where) {
101
+ case "peek":
102
+ return s.open && (!s.inPeek || s.closeAt !== null || s.pending) ? peekStep(s, { type: "peekEnter", t }) : s;
103
+ case "line":
104
+ // On the open line: no grace, and a takeover armed elsewhere (its leave lost) is dropped.
105
+ return s.closeAt !== null || s.pending || s.inPeek ? { ...s, pending: null, closeAt: null, inPeek: false } : s;
106
+ case "pending":
107
+ return s;
108
+ case "away":
109
+ if (s.sticky) return s.pending ? { ...s, pending: null } : s;
110
+ if (!s.pending && !s.inPeek && (s.closeAt !== null || !s.open)) return s;
111
+ // One grace from the first move away; later moves never push it back.
112
+ return { ...s, pending: null, inPeek: false, closeAt: s.open ? s.closeAt ?? t + CLOSE_MS : null };
113
+ }
114
+ }
115
+
82
116
  /** When the machine next needs a tick, or null. */
83
117
  export function peekDeadline(s: PeekState): number | null {
84
118
  const at = [s.pending?.at, s.closeAt ?? undefined].filter((n): n is number => typeof n === "number");
85
119
  return at.length ? Math.min(...at) : null;
86
120
  }
121
+
122
+ /**
123
+ * How long the host waits before its next tick, or null for none. Browsers fire setTimeout up to ~1 ms before its
124
+ * delay on performance.now(), and a tick before the deadline changes nothing (the same state back), so a host that
125
+ * re-arms only on a state change would never tick again. The host asks this when the timer fires and ticks only at 0,
126
+ * else waits again for what is left; the 1 ms margin makes a second wait rare.
127
+ */
128
+ export function peekWait(s: PeekState, now: number): number | null {
129
+ const at = peekDeadline(s);
130
+ return at === null ? null : now >= at ? 0 : Math.ceil(at - now) + 1;
131
+ }
package/shared/search.ts CHANGED
@@ -383,6 +383,19 @@ export function rowHit(hit: SearchHit, row: { title: string; agent?: string | nu
383
383
  return { titleRanges, agentRanges, lineRanges: null, via: hit.via };
384
384
  }
385
385
 
386
+ const sameRanges = (a: Range[] | null | undefined, b: Range[] | null | undefined) =>
387
+ a === b || (!!a && !!b && a.length === b.length && a.every((r, i) => r[0] === b[i]![0] && r[1] === b[i]![1]));
388
+ /**
389
+ * typing-never-redraws-unchanged-rows (invariant 148): two hits draw the same row when their highlights and their
390
+ * "<Field> · excerpt" line are equal. Each key builds new hit objects, so Row compares them by this, not by identity.
391
+ */
392
+ export function sameHit(a: RowHit | null | undefined, b: RowHit | null | undefined): boolean {
393
+ if (a === b) return true;
394
+ if (!a || !b) return !a && !b;
395
+ return sameRanges(a.titleRanges, b.titleRanges) && sameRanges(a.agentRanges, b.agentRanges) && sameRanges(a.lineRanges, b.lineRanges)
396
+ && (a.via === b.via || (!!a.via && !!b.via && a.via.field === b.via.field && a.via.text === b.via.text && sameRanges(a.via.ranges, b.via.ranges)));
397
+ }
398
+
386
399
  /**
387
400
  * The sidebar view's filter (2.1): the same matcher and the same rank as Home's search, applied in place. Groups keep
388
401
  * their order; inside each, rows rank as Home's search ranks them (`byRank`: title matches first) and an equal rank