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

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.
package/client/field.tsx CHANGED
@@ -1,17 +1,46 @@
1
1
  // Every text field in Follow-up (`the-keyboard-never-covers-a-field`, tests/keyboard-field.test.ts): the SDK's
2
2
  // TextInput, so Paseo still positions it inside its sheets, plus a report to the nearest KeyboardRoom
3
3
  // (client/keyboard.tsx) when it gains or loses focus, so the room keeps it above a phone's keyboard.
4
- import { forwardRef, useCallback, useRef } from "react";
5
- import type { TextInput as NativeTextInput, TextInputProps } from "react-native";
4
+ // A one-line field's placeholder always fits its line (`a-placeholder-never-wraps`, invariant 153,
5
+ // shared/placeholder-fit.ts): Android's EditText wraps a one-line field's hint and the field clips the second line,
6
+ // so the field measures its own text room and draws the longest wording that fits.
7
+ import { forwardRef, useCallback, useRef, useState } from "react";
8
+ import { Platform, StyleSheet, useWindowDimensions, type LayoutChangeEvent, type TextInput as NativeTextInput, type TextInputProps } from "react-native";
6
9
  import { TextInput } from "@getpaseo/plugin/client/ui";
7
10
  import { useFieldRoom, type FocusedField } from "./keyboard";
11
+ import { drawnFontSize, estimateTextWidth, fitPlaceholder, fullPlaceholder, textRoom, type Placeholder } from "../shared/placeholder-fit";
8
12
 
9
13
  export type FieldRef = NativeTextInput;
14
+ export type FieldProps = Omit<TextInputProps, "placeholder"> & {
15
+ /** The hint, or its wordings preferred first ("Search or ask the Overseer", "Search or ask", "Search"). */
16
+ placeholder?: Placeholder;
17
+ };
10
18
 
11
- export const Field = forwardRef<NativeTextInput, TextInputProps>(function Field({ onFocus, onBlur, ...props }, ref) {
19
+ /** Android's EditText pads its text where the style sets no horizontal padding (Material: about 12 dp a side). */
20
+ const ANDROID_TEXT_PAD = 12;
21
+
22
+ type WebInput = { getBoundingClientRect?: () => unknown; ownerDocument?: { defaultView?: { getComputedStyle(n: unknown): Record<string, string> } } };
23
+ let canvas: { getContext(k: "2d"): { font: string; measureText(t: string): { width: number } } | null } | null = null;
24
+ /** The browser's own measure of `text` in this input's font, or null where there is none (native, tests). */
25
+ function webMeasure(node: unknown): ((text: string) => number) | null {
26
+ const input = node as WebInput | null;
27
+ const css = input?.ownerDocument?.defaultView?.getComputedStyle(input);
28
+ const doc = (globalThis as { document?: { createElement(t: string): unknown } }).document;
29
+ if (!css || !doc) return null;
30
+ canvas ??= doc.createElement("canvas") as typeof canvas;
31
+ const ctx = canvas?.getContext("2d");
32
+ if (!ctx) return null;
33
+ ctx.font = css.font || `${css.fontStyle} ${css.fontWeight} ${css.fontSize} ${css.fontFamily}`;
34
+ const spacing = parseFloat(css.letterSpacing) || 0;
35
+ return text => ctx.measureText(text).width + spacing * [...text].length + 1;
36
+ }
37
+
38
+ export const Field = forwardRef<NativeTextInput, FieldProps>(function Field({ onFocus, onBlur, onLayout, placeholder, accessibilityLabel, ...props }, ref) {
12
39
  const own = useRef<NativeTextInput | null>(null);
13
40
  const { room, scroll } = useFieldRoom();
14
41
  const me = useRef<FocusedField | null>(null);
42
+ const [width, setWidth] = useState<number | null>(null);
43
+ const { fontScale } = useWindowDimensions();
15
44
  const setRef = useCallback((input: NativeTextInput | null) => {
16
45
  own.current = input;
17
46
  if (typeof ref === "function") ref(input); else if (ref) ref.current = input;
@@ -29,5 +58,26 @@ export const Field = forwardRef<NativeTextInput, TextInputProps>(function Field(
29
58
  if (me.current) room?.blur(me.current);
30
59
  onBlur?.(e);
31
60
  };
32
- return <TextInput {...props} ref={setRef} onFocus={focus} onBlur={blur} />;
61
+ // Only a one-line field with a hint measures itself; a multi-line field's hint wraps as its text does.
62
+ const fits = placeholder !== undefined && !props.multiline;
63
+ const layout = (e: LayoutChangeEvent) => {
64
+ const w = Math.round(e.nativeEvent.layout.width);
65
+ if (fits && w !== width) setWidth(w);
66
+ onLayout?.(e);
67
+ };
68
+ const full = placeholder === undefined ? undefined : fullPlaceholder(placeholder);
69
+ // Before its width is known a phone field shows its shortest wording, so Android never draws one frame wrapped.
70
+ let shown = fits && width === null && Platform.OS !== "web" ? fitPlaceholder(placeholder, null, () => 0, "shortest") : full;
71
+ if (fits && width !== null) {
72
+ const style = (StyleSheet.flatten(props.style) ?? {}) as Record<string, unknown>;
73
+ const web = Platform.OS === "web" ? webMeasure(own.current) : null;
74
+ const size = drawnFontSize(style, Platform.OS === "web" ? 1 : fontScale, props);
75
+ const spacing = typeof style.letterSpacing === "number" ? style.letterSpacing : 0;
76
+ const measure = web ?? ((t: string) => estimateTextWidth(t, size, spacing));
77
+ shown = fitPlaceholder(placeholder, textRoom(width, style, Platform.OS === "android" ? ANDROID_TEXT_PAD : 0), measure);
78
+ }
79
+ // A one-line field is named by its full wording whatever the width shows, so a screen reader hears one name.
80
+ const label = accessibilityLabel ?? (fits ? full : undefined);
81
+ return <TextInput {...props} placeholder={shown} accessibilityLabel={label} numberOfLines={props.multiline ? props.numberOfLines : 1}
82
+ ref={setRef} onFocus={focus} onBlur={blur} onLayout={fits || onLayout ? layout : undefined} />;
33
83
  });
@@ -8,6 +8,7 @@ import { Icon, ScrollView, useToast } from "@getpaseo/plugin/client/ui";
8
8
  import { homeCounts, type HomeGroupId, type HomeModel } from "../shared/home";
9
9
  import { layoutHint, filterHome, homeSearchDocs, indexDocs, defaultActive, omniboxResults, overseerProvider, workspaceProvider, type OmniboxItem, type OmniboxProvider } from "../shared/search";
10
10
  import { LayoutCapture, type LayoutKey } from "../shared/layout-swap";
11
+ import { fullPlaceholder, type Placeholder } from "../shared/placeholder-fit";
11
12
  import { DEFAULT_SORT, isMenuSort, MENU_SORTS, SORT_HINT, SORT_LABEL, type SortMode } from "../shared/sort";
12
13
  import { GROUPING_LABEL, GROUPINGS, homeViewFiltered, SHOW_ITEMS, SHOW_LABEL, TITLE_LABEL, TITLE_SOURCES, type HomeView } from "../shared/home-arrange";
13
14
  import { PRIORITY_SOURCE_LABEL } from "../shared/priorities";
@@ -146,7 +147,9 @@ export function QueryField({ theme, value, onChange, placeholder, icon, dense, i
146
147
  autoFocus?: boolean;
147
148
  /** Esc's own action (a section search closes); without it Esc clears, then leaves the field. */
148
149
  onEscape?: () => void;
149
- theme: Theme; value: string; onChange: (q: string) => void; placeholder: string; icon: string; dense: boolean;
150
+ theme: Theme; value: string; onChange: (q: string) => void; icon: string; dense: boolean;
151
+ /** Its wordings, preferred first: the field shows the longest that fits its one line (invariant 153). */
152
+ placeholder: Placeholder;
150
153
  /** The key chip at the field's end (web, desktop width): "/" or the search-from-anywhere key; false for none. */
151
154
  /** The chip's hover title (web): what each key does. */
152
155
  slashTitle?: string;
@@ -179,7 +182,7 @@ export function QueryField({ theme, value, onChange, placeholder, icon, dense, i
179
182
  borderWidth: 1, borderColor: focused ? withAlpha(c.foreground, 0.35) : c.border, backgroundColor: c.surface1 }}>
180
183
  <Icon name={icon as never} size={dense ? 16 : 13} color={c.foregroundMuted} />
181
184
  <Field ref={inputRef} onLayout={onLayout} value={value} onChangeText={q => { onLayoutQuery?.(capture.current.change(q)); onChange(q); }} placeholder={placeholder} placeholderTextColor={c.foregroundMuted}
182
- accessibilityLabel={placeholder} autoFocus={autoFocus} autoCorrect={false} autoCapitalize="none" spellCheck={false} returnKeyType="go"
185
+ accessibilityLabel={fullPlaceholder(placeholder)} autoFocus={autoFocus} autoCorrect={false} autoCapitalize="none" spellCheck={false} returnKeyType="go"
183
186
  {...(listKeys || onLayout ? { dataSet: { ...(listKeys ? { listKeys: "1" } : {}), ...(onLayout ? { followUpSearch: "1" } : {}) } } as object : {})}
184
187
  onFocus={() => setFocused(true)} onBlur={() => setFocused(false)}
185
188
  onSubmitEditing={onSubmit}
@@ -195,7 +198,7 @@ export function QueryField({ theme, value, onChange, placeholder, icon, dense, i
195
198
  style={{ flex: 1, minWidth: 0, color: c.foreground, fontSize: dense ? 15 : 13, paddingVertical: 0, ...(Platform.OS === "web" ? { outlineStyle: "none" } as object : {}) }} />
196
199
  {trailing}
197
200
  {count !== undefined ? !!count && <Text accessibilityLiveRegion="polite" style={{ color: c.foregroundMuted, fontSize: dense ? 13 : 12, fontVariant: ["tabular-nums"] }}>{count}</Text>
198
- : !!value && <Pressable accessibilityRole="button" accessibilityLabel={`Clear ${placeholder.toLowerCase()}`} hitSlop={dense ? 14 : 8} onPress={() => { onChange(""); inputRef.current?.focus(); }}>
201
+ : !!value && <Pressable accessibilityRole="button" accessibilityLabel={`Clear ${fullPlaceholder(placeholder).toLowerCase()}`} hitSlop={dense ? 14 : 8} onPress={() => { onChange(""); inputRef.current?.focus(); }}>
199
202
  <Icon name="X" size={dense ? 16 : 13} color={c.foregroundMuted} />
200
203
  </Pressable>}
201
204
  {slashHint && !value && !focused && !dense && Platform.OS === "web" && <Text accessibilityElementsHidden importantForAccessibility="no"
@@ -204,6 +207,11 @@ export function QueryField({ theme, value, onChange, placeholder, icon, dense, i
204
207
  </View>;
205
208
  }
206
209
 
210
+ /** Home's search wordings, longest first: a phone's half-width field shows the longest that fits (invariant 153). */
211
+ export const searchPlaceholder = (askOn: boolean, dense: boolean): readonly string[] => askOn
212
+ ? [dense ? "Search or ask the Overseer" : "Search, or ask the Overseer", "Search or ask", "Search"]
213
+ : ["Search workspaces, branches, PRs", "Search workspaces", "Search"];
214
+
207
215
  /**
208
216
  * Home's search. Its chip names the search-from-anywhere key when one is set (it works here too), else "/"; plain "/"
209
217
  * focuses it on Home either way (useSlashToFocus).
@@ -211,7 +219,7 @@ export function QueryField({ theme, value, onChange, placeholder, icon, dense, i
211
219
  /** `onEnter`: the active result, or null when the query is empty (Home then opens its selection). */
212
220
  export function SearchField({ theme, omnibox, dense, onEnter, anywhereKey }: { theme: Theme; omnibox: Omnibox; dense: boolean; onEnter: (item: OmniboxItem | null) => void; anywhereKey?: string | null }) {
213
221
  const { query, setQuery, move, inputRef, askOn } = omnibox;
214
- const placeholder = askOn ? dense ? "Search or ask the Overseer" : "Search, or ask the Overseer" : "Search workspaces, branches, PRs";
222
+ const placeholder = searchPlaceholder(askOn, dense);
215
223
  // The bar stays one line: a paste or drop lands here, and Home draws the thumbnails on their own line under it.
216
224
  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 || "/"}
217
225
  trailing={<AttachImageButton model={omnibox.images} theme={theme} compact={dense} label="Add image for the Overseer" />}
@@ -245,7 +253,7 @@ export function useListFilter(model: HomeModel, sources: HomeSources): ListFilte
245
253
  }
246
254
  /** "Filter workspaces": a filter icon and no key binding, so it never reads as Paseo's own Search (the Command Center, ⌘K). */
247
255
  export function FilterField({ theme, filter, dense }: { theme: Theme; filter: ListFilter; dense: boolean }) {
248
- return <QueryField theme={theme} onLayoutQuery={filter.setPhysical} value={filter.query} onChange={filter.setQuery} placeholder="Filter workspaces" icon="ListFilter" dense={dense} inputRef={filter.inputRef} slashHint={false} listKeys />;
256
+ return <QueryField theme={theme} onLayoutQuery={filter.setPhysical} value={filter.query} onChange={filter.setQuery} placeholder={["Filter workspaces", "Filter"]} icon="ListFilter" dense={dense} inputRef={filter.inputRef} slashHint={false} listKeys />;
249
257
  }
250
258
 
251
259
  /** Kept outside the textbox: never changes the query or adds a decision to the search flow. */
@@ -4,7 +4,7 @@ import { Pressable, Text } from "./text";
4
4
  import { openExternalUrl, useRpc, type PluginHostProps } from "@getpaseo/plugin/client";
5
5
  import { Icon, Modal, ScrollView } from "@getpaseo/plugin/client/ui";
6
6
  import { reportLinkRpc, reportSendRpc, reportTargetsRpc } from "../shared/contracts";
7
- import { NEW_AGENT, NEW_WORKSPACE, PICKER_MAX, defaultChoice, pickerScrolls, newAgentLines, pickerRows, targetLines, type PickerRow, type SendTargets } from "../shared/report-send";
7
+ import { ABOUT_LINE, NEW_AGENT, NEW_WORKSPACE, PICKER_MAX, reportAbout, defaultChoice, pickerScrolls, newAgentLines, pickerRows, targetLines, type PickerRow, type SendTargets } from "../shared/report-send";
8
8
  import { errorText } from "../shared/errors";
9
9
  import { BRAND_ICONS } from "./brand-icons";
10
10
  import { Button, SubmitScope, text } from "./kit";
@@ -19,7 +19,9 @@ import { Field } from "./field";
19
19
  * interviews them, dry-runs follow_report_issue and shows the exact issue before filing it.
20
20
  */
21
21
  export type ReportKind = "bug" | "feature" | "feedback";
22
- export type ReportRequest = { kind?: ReportKind; error?: string | null; at?: number; agentId?: string; workspaceId?: string };
22
+ export type ReportRequest = { kind?: ReportKind; error?: string | null; at?: number; agentId?: string; workspaceId?: string;
23
+ /** The workspace the report is about (the row menu's Report a bug…) and its title, for the About line. */
24
+ about?: string; aboutTitle?: string };
23
25
 
24
26
  const slot = createHostSlot<ReportRequest>();
25
27
  /**
@@ -78,13 +80,16 @@ export function ReportSheet({ request, theme, layout, openAgent, onClose }: { re
78
80
  const [choosing, setChoosing] = useState(false);
79
81
  const [phase, setPhase] = useState<Phase>({ kind: "edit" });
80
82
  const [targets, setTargets] = useState<SendTargets | null>(null);
83
+ const [aboutRemoved, setAboutRemoved] = useState(false);
84
+ const about = reportAbout(request, kind, aboutRemoved);
85
+ const aboutName = request.aboutTitle || "this workspace";
81
86
  const readTargets = useRpc(reportTargetsRpc); const send = useRpc(reportSendRpc); const link = useRpc(reportLinkRpc);
82
87
  useEffect(() => {
83
88
  let live = true;
84
89
  readTargets({ workspaceId: request.workspaceId, agentId: request.agentId }).then(r => { if (live) setTargets(r); }).catch(() => { if (live) setTargets({ agents: [], defaultId: null, newAgentWorkspace: null }); });
85
90
  return () => { live = false; };
86
91
  }, [request.workspaceId, request.agentId]);
87
- const chosen = picked ?? (targets ? defaultChoice(targets) : null);
92
+ const chosen = picked ?? (targets ? defaultChoice(targets, about) : null);
88
93
  const rows = targets ? pickerRows(targets) : { pinned: [], agents: [] };
89
94
  const chosenRow = [...rows.pinned, ...rows.agents].find(r => r.id === chosen) ?? null;
90
95
  const nowhere = !!targets && !targets.agents.length && !targets.newAgentWorkspace && !targets.newWorkspace;
@@ -94,7 +99,7 @@ export function ReportSheet({ request, theme, layout, openAgent, onClose }: { re
94
99
  if (empty || phase.kind === "sending" || !chosen) return;
95
100
  setPhase({ kind: "sending" });
96
101
  try {
97
- const r = await send({ kind, text: words, error, ...(chosen === NEW_AGENT ? { newAgentWorkspaceId: targets!.newAgentWorkspace!.id } : chosen === NEW_WORKSPACE ? { newWorkspaceProjectId: targets!.newWorkspace!.projectId } : { agentId: chosen }) });
102
+ const r = await send({ kind, text: words, error, ...(about ? { workspaceId: about } : {}), ...(chosen === NEW_AGENT ? { newAgentWorkspaceId: targets!.newAgentWorkspace!.id } : chosen === NEW_WORKSPACE ? { newWorkspaceProjectId: targets!.newWorkspace!.projectId } : { agentId: chosen }) });
98
103
  setPhase({ kind: "sent", ...r });
99
104
  } catch (e) { setPhase({ kind: "failed", message: errorText(e) }); }
100
105
  };
@@ -139,6 +144,18 @@ export function ReportSheet({ request, theme, layout, openAgent, onClose }: { re
139
144
  </View>
140
145
  <Pressable accessibilityRole="button" accessibilityLabel="Remove the error" hitSlop={8} onPress={() => setError(null)}><Icon name="X" size={14} color={c.foregroundMuted} /></Pressable>
141
146
  </View>}
147
+ {about ? <View style={{ flexDirection: "row", gap: 8, alignItems: "flex-start", backgroundColor: c.surface2, borderRadius: 8, padding: 10 }}>
148
+ <Icon name="Folder" size={14} color={c.foregroundMuted} />
149
+ <View style={{ flex: 1, minWidth: 0 }}>
150
+ <Text numberOfLines={1} style={t.body}>About {aboutName}</Text>
151
+ <Text style={t.meta}>{ABOUT_LINE}</Text>
152
+ </View>
153
+ <Pressable accessibilityRole="button" accessibilityLabel={`Don't include ${aboutName}`} hitSlop={compact ? 14 : 8} onPress={() => setAboutRemoved(true)}
154
+ style={{ minWidth: compact ? 28 : 16, minHeight: compact ? 28 : 16, alignItems: "center", justifyContent: "center" }}><Icon name="X" size={14} color={c.foregroundMuted} /></Pressable>
155
+ </View> : request.about && kind === "bug" && aboutRemoved ? <Pressable accessibilityRole="button" onPress={() => setAboutRemoved(false)} hitSlop={8}
156
+ style={{ flexDirection: "row", alignItems: "center", gap: 6, alignSelf: "flex-start", minHeight: compact ? 44 : 0 }}>
157
+ <Icon name="Plus" size={14} color={c.foregroundMuted} /><Text style={t.meta}>Include {aboutName}</Text>
158
+ </Pressable> : null}
142
159
  <Field value={words} onChangeText={setWords} multiline autoFocus={!compact} placeholder={placeholder} placeholderTextColor={c.foregroundMuted} accessibilityLabel="Describe it"
143
160
  style={{ minHeight: compact ? 132 : 112, borderWidth: 1, borderColor: c.border, borderRadius: 8, backgroundColor: c.surface0, paddingHorizontal: 12, paddingVertical: 10, color: c.foreground, fontSize: compact ? 14 : 13, lineHeight: compact ? 20 : 18, textAlignVertical: "top" }} />
144
161
  {nowhere ? <View style={{ flexDirection: "row", gap: 10, padding: 12, borderRadius: 8, backgroundColor: c.surface2 }}>
@@ -9,6 +9,7 @@ import { rowMenu, type LaterChoice, type RowMenuItem } from "../shared/row-menu"
9
9
  import type { Workstream } from "../shared/home";
10
10
  import { aboutKey } from "./about";
11
11
  import { openRename } from "./rename";
12
+ import { openReportSheet } from "./report-issue";
12
13
  import { bindToast, runAction } from "./toast-store";
13
14
  import type { HomeSources } from "./home-data";
14
15
 
@@ -97,6 +98,7 @@ export function useRowMenu(host: RowMenuHost) {
97
98
  case "unpin": return runAction({ label: "Unpin", run: async () => { await deps().setPinned!(workspaceId, false); }, success: `Unpinned ${s.title}`, failure: `Couldn't unpin ${s.title}` }, `pin:${workspaceId}`);
98
99
  case "copy_branch": return runAction({ label: "Copy branch", run: () => copyText(arg), success: "Branch name copied", failure: "Couldn't copy here" });
99
100
  case "rewrite_summary": return runAction({ label: "Rewrite summary", run: async () => cache.setQueryData(aboutKey(workspaceId), await about({ workspaceId, open: true, refresh: true })), success: "Summary rewritten" }, `about:${workspaceId}`);
101
+ case "report": return runAction({ label: "Report a bug", run: async () => openReportSheet({ kind: "bug", workspaceId, about: workspaceId, aboutTitle: s.title }), success: null });
100
102
  case "rename_ai": return runAction({ label: "Rename title with AI", run: async () => openRename({ workspaceId, title: s.title }), success: null });
101
103
  case "make_main": return runAction({ label: "Make main agent", run: async () => { await control({ workspaceId, mainAgentId: arg }); after(); }, success: `${s.agent ?? "That agent"} is now the main agent` }, `main:${workspaceId}`);
102
104
  case "stop_following": return runAction({ label: "Stop following", run: async () => { await setFollow({ workspace: { workspaceId, follow: false } }); after(); }, success: `Stopped following ${s.title}` }, `follow:${workspaceId}`);
package/index.server.ts CHANGED
@@ -152,6 +152,7 @@ import { updatesViewSchema, type UpdatesView } from "./shared/updates";
152
152
  import { PLUGIN_NAME, releaseNotesViewSchema, type ReleaseNote, type ReleaseNotesView } from "./shared/changelog";
153
153
  import { BRIEF_KIND, BRIEF_VERSION, prState, prStates, validateNeedsYou, type NeedsYouRecord } from "./shared/brief";
154
154
  import { foldedAsk } from "./shared/needs-block";
155
+ import { ARCHIVED_NEEDS_YOU_NOTE, paseoShowsLive } from "./shared/reopen";
155
156
  import { ImageStore } from "./server/image-store";
156
157
  import type { ImageRef, ImageUpload } from "./shared/images";
157
158
  import { imageSupport, trustHarnessImageProviders } from "./server/image-support";
@@ -513,6 +514,8 @@ export default function contribute(server: PluginServerContext) {
513
514
  };
514
515
  // Hooks run in the background; an inbox failure never blocks the rest of Follow-up.
515
516
  const inboxHook = (work: () => Promise<void>) => void (async () => { await ready; if (!stopped && !loadError) { await work(); feeds.inbox(); } })().catch(error => { inboxError = error instanceof Error ? error.message : String(error); });
517
+ // A workspace the engine reopened (Paseo shows it live again) shows its main agent's Needs-you row again (invariant 111).
518
+ engine.reopened = agentIds => { for (const id of agentIds) inboxHook(async () => { await inbox.reopen(id); }); };
516
519
  let unlock: (() => Promise<void>) | null = null;
517
520
  let stopped = false;
518
521
  /** Each agent's latest started turn, so a turn end can tell it was already replaced (holdOnTurnEnd). */
@@ -711,9 +714,26 @@ export default function contribute(server: PluginServerContext) {
711
714
  void (async () => { await ready; if (stopped || loadError) return; void inbox.refreshDirectory().catch(() => undefined); if (governor.allowsExtras()) void usage.refresh(); await inbox.start().catch(error => { inboxError = error instanceof Error ? error.message : String(error); }); void inboxLoop(); })();
712
715
  const changed = (w: Workspace) => { w.completion = null; w.declaration = null; w.updatedAt = new Date().toISOString(); };
713
716
 
717
+ /**
718
+ * Archived is Paseo's state, never a latch (invariant 111, shared/reopen.ts): a main agent calling a tool from a
719
+ * workspace Follow-up reads as archived reopens it when Paseo shows it live (the agent itself unarchived: a prompt
720
+ * did it). True when the workspace is (now) followed; false when Paseo still has it archived.
721
+ */
722
+ const reopenForCaller = async (agent: { id: string; workspaceId?: string | null; archivedAt?: string | null }): Promise<boolean> => {
723
+ const record = (await store.snapshot()).workspaces.find(w => w.id === agent.workspaceId);
724
+ if (!record?.archived || !record.enable_tracking || record.mainAgentId !== agent.id) return !record?.archived;
725
+ const rows = await gateway.directory.read().catch(() => null);
726
+ if (!paseoShowsLive(record.id, rows?.workspaces.find(row => row.id === record.id), agent)) return false;
727
+ await store.mutateWorkspace(record.id, w => { if (w.archived) { w.archived = false; w.updatedAt = new Date().toISOString(); } });
728
+ await inbox.reopen(agent.id).catch(() => false);
729
+ feeds.inbox();
730
+ void engine.nudge(record.id);
731
+ return true;
732
+ };
714
733
  const callerWorkspaceId = async (agentId: string, paseo: PluginHandlerContext["paseo"], allowHandoff = true) => {
715
734
  const agent = (await paseo.agents.ref(agentId).refresh())?.agent;
716
735
  if (!agent?.workspaceId) throw new Error(`Cannot locate the caller's workspace: expected agent in a recorded workspace, received agent ${agentId}.`);
736
+ await reopenForCaller(agent);
717
737
  const record = (await store.snapshot()).workspaces.find(w => w.id === agent.workspaceId);
718
738
  if (record?.contributorAgentIds?.includes(agentId) && !record.batches.some(b => b.recipientAgentId === agentId && !b.settledAt && b.tasks.every(t => t.kind === "inventory")) && (!await isWorkspaceRoot(agent, async id => (await paseo.agents.ref(id).refresh())?.agent) || isRecovery(agent.labels))) throw new Error("PR registration requires an available root agent in this tracked workspace.");
719
739
  if (allowHandoff) {
@@ -853,7 +873,8 @@ export default function contribute(server: PluginServerContext) {
853
873
  const workspace = await paseo.workspaces.ref(agent.workspaceId).refresh();
854
874
  if (!workspace) throw new Error("Workspace is unavailable.");
855
875
  return store.mutate(state => {
856
- const w = agentWorkspace(state, agentId, "write", agent.workspaceId!);
876
+ // enroll_workspace states a new goal: it follows the workspace again even while Paseo has it archived.
877
+ const w = agentWorkspace(state, agentId, "write", agent.workspaceId!, "owner", true);
857
878
  if (w) {
858
879
  if (w.goal !== goal) changed(w);
859
880
  w.goal = goal; w.title = workspace.name; w.archived = false;
@@ -1938,6 +1959,9 @@ export default function contribute(server: PluginServerContext) {
1938
1959
  github: githubApi(), updates: () => updatesView(), call: (method, input) => rpcBridge.call(method, input ?? {}), snapshot: () => store.snapshot(),
1939
1960
  resources: () => governor.current(), serverInfo: () => withDaemon(async client => (client as ServerInfoClient).getLastServerInfoMessage?.() as never), logs: logRing,
1940
1961
  toolTransport: () => toolTransport, startedAt,
1962
+ // A report about one workspace: its agents from the directory (metadata only, wakes nothing).
1963
+ agents: async workspaceId => ((await gateway.directory.read().catch(() => null))?.agents ?? []).map(r => r.agent).filter(a => a.workspaceId === workspaceId && !a.archivedAt && !a.background)
1964
+ .map(a => ({ id: a.id, title: a.title ?? null, provider: a.provider, status: a.status })),
1941
1965
  });
1942
1966
  const agentActions = new AgentActions({ timeZone: () => clientTimeZone, autoSendsHeld: () => !governor.allowsBackground(), store, prActions: actions, engine, inbox, priorities: priorityStore, about, agentSettings, wait: { status: currentWait }, prWorkflows: () => prWorkflowView(), rpc: rpcBridge, display: displayBridge, report: { run: (caller, args) => reportKit.reporter.run(caller, args) }, agentTitle: async id => (await api?.agents.ref(id).refresh().catch(() => null))?.agent?.title ?? null,
1943
1967
  pins: {
@@ -2104,8 +2128,12 @@ export default function contribute(server: PluginServerContext) {
2104
2128
  if (!/^[\w-]+$/.test(agentId)) throw new Error("Unsupported agent identity.");
2105
2129
  const agent = (await paseo.agents.ref(agentId).refresh())?.agent;
2106
2130
  if (!agent?.workspaceId) throw new Error("Cannot locate the caller's workspace.");
2131
+ // Invariant 111: the main agent's ask from a workspace Follow-up read as archived reopens it when Paseo shows it
2132
+ // live; where Paseo still has it archived, the ask still reaches Needs you and the reply says so.
2133
+ const followed = !isRecovery(agent.labels) && await reopenForCaller(agent);
2107
2134
  const saved = await store.snapshot();
2108
2135
  const tracked = saved.workspaces.find(w => w.id === agent.workspaceId && w.enable_tracking && !w.archived);
2136
+ const stillArchived = !followed && saved.workspaces.some(w => w.id === agent.workspaceId && w.enable_tracking && w.archived && w.mainAgentId === agentId);
2109
2137
  // F2: root agents only. Contributors and recovery sessions report to the main agent; subagents to their parent.
2110
2138
  if (isRecovery(agent.labels) || tracked && tracked.mainAgentId !== agentId) throw new Error("needs_you is for the workspace's main agent. Report to the main agent instead.");
2111
2139
  if (!await isWorkspaceRoot(agent, async id => (await paseo.agents.ref(id).refresh())?.agent)) throw new Error("needs_you is for root agents. Report to your parent agent instead.");
@@ -2135,7 +2163,7 @@ export default function contribute(server: PluginServerContext) {
2135
2163
  const { questions: _refs, ...rest } = call;
2136
2164
  call = { ...rest, ...(linked.decisions.length ? { decisions: linked.decisions } : {}) };
2137
2165
  if (!linked.decisions.length) delete call.decisions;
2138
- } else if (call.questions?.length) throw new Error("questions point at a tracked workspace's open questions, and this workspace isn't tracked.");
2166
+ } else if (call.questions?.length) throw new Error(stillArchived ? "questions point at a tracked workspace's open questions, and Paseo has this workspace archived. Leave questions out and state the ask in ask and decisions; ask the developer to unarchive the workspace." : "questions point at a tracked workspace's open questions, and this workspace isn't tracked.");
2139
2167
  // dismissing-anything-in-needs-you-sends-the-agent-nothing: an ask the developer dismissed, stated again with nothing
2140
2168
  // new to decide, isn't flagged again: the turn ends quiet, and the call says why.
2141
2169
  const gone = await inbox.dismissedAsk(agentId);
@@ -2146,8 +2174,11 @@ export default function contribute(server: PluginServerContext) {
2146
2174
  const temporary = `${needsYouPath(agentId)}.${randomUUID()}`;
2147
2175
  await writeFile(temporary, JSON.stringify(record), { mode: 0o600 });
2148
2176
  await rename(temporary, needsYouPath(agentId));
2177
+ // The caller is running, so its Needs-you row is live: an archived (gone) row would hide the brief this turn makes.
2178
+ if (!restated && call.kind !== "done") { await inbox.reopen(agentId).catch(() => false); feeds.inbox(); }
2149
2179
  return { ok: true as const, briefId: `brief:${turn?.turnId ?? record.at}`,
2150
2180
  ...(restated ? { note: DISMISSED_ASK_NOTE }
2181
+ : stillArchived && call.kind !== "done" ? { note: ARCHIVED_NEEDS_YOU_NOTE }
2151
2182
  : dismissed.length ? { note: `The developer dismissed ${dismissed.join(", ")}: ${dismissed.length === 1 ? "it no longer matters, so it was" : "they no longer matter, so they were"} left off the card. Don't raise ${dismissed.length === 1 ? "it" : "them"} again.` } : {}) };
2152
2183
  });
2153
2184
  // Replies once the answer is recorded; the send runs after (Inbox.briefAction), so a dormant agent's slow resume never
@@ -2284,14 +2315,15 @@ export default function contribute(server: PluginServerContext) {
2284
2315
  server.on("agent.turn_started", async event => { await ready; if (stopped || loadError || !overseer) return; await overseer.turnStarted(event.agent.id).catch(() => undefined); }),
2285
2316
  // A newer main-agent turn supersedes the failed turn's automatic hold (shared/status.ts holdSuperseded).
2286
2317
  // A turn writes only the workspace it is about (server/turn-events.ts, a-send-never-clones-the-whole-state): a
2287
- // superseded hold lifts, the owned workspace's Done ends, and a dormant workspace becomes active again.
2318
+ // superseded hold lifts, the owned workspace's Done ends, the main agent's archived workspace reopens (invariant
2319
+ // 111), and a dormant workspace becomes active again.
2288
2320
  server.on("agent.turn_started", async event => {
2289
2321
  if (event.turnId) startedTurns.set(event.agent.id, event.turnId);
2290
2322
  await ready;
2291
2323
  if (stopped || loadError) return;
2292
- const { lifted, owned, woken } = await turnStarted(store, event.agent, event.turnId ?? null);
2324
+ const { lifted, owned, woken, reopened } = await turnStarted(store, event.agent, event.turnId ?? null);
2293
2325
  if (owned) gateway.markDirty(event.agent.id);
2294
- for (const id of new Set([...lifted, ...(woken ? [woken] : [])])) void engine.nudge(id);
2326
+ for (const id of new Set([...lifted, ...(woken ? [woken] : []), ...(reopened ? [reopened] : [])])) void engine.nudge(id);
2295
2327
  }),
2296
2328
  server.on("agent.turn_ended", async (event, { paseo }) => { seen(paseo); inboxHook(() => inbox.turnEnded(event.agent, event.outcome, event.turnId)); }),
2297
2329
  server.on("agent.permission_requested", async (event, { paseo }) => { seen(paseo); inboxHook(async () => { await inbox.permissionRequested(event.agent, event.request); await writeBriefState(); }); }),
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.5",
4
+ "version": "2.6.0-beta.6",
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": [
@@ -210,7 +210,8 @@ export const TOOL_INPUT = {
210
210
  display_settings: z.strictObject({}),
211
211
  make_main_agent: z.strictObject({ agentId: id.optional(), reason: z.string().trim().min(1).max(200).optional(), requested: z.enum(["developer", "self"]).optional(), ...confirm }),
212
212
  set_display: z.strictObject({ values: z.record(z.string(), z.union([z.boolean(), z.string(), z.number(), z.record(z.string(), z.unknown())])).optional(), ...confirm }),
213
- report_issue: reportInputSchema,
213
+ // workspace_id is the shared module's subject (followUpReportConfig): it reads and strips it before its own schema.
214
+ report_issue: reportInputSchema.extend({ workspace_id: id.optional() }),
214
215
  ...Object.fromEntries(RPC_TOOLS.map(t => [t.name, t.input])),
215
216
  } as unknown as Record<AgentTool, z.ZodType>;
216
217
 
@@ -162,7 +162,7 @@ export const RPC_TOOLS: readonly RpcTool[] = [
162
162
  // Report an issue's Send: to an agent, a new agent in a workspace, or a new workspace (server/report-send.ts). The dry
163
163
  // run shows the targets the sheet offers; an agent reporting for itself files with report_issue instead.
164
164
  { name: "report_send", rpc: "follow.report-issue-send", kind: "planned", before: { rpc: "follow.report-issue-targets", input: () => ({}) },
165
- input: z.strictObject({ kind: reportKindSchema.optional(), text: z.string().max(8000).optional(), error: z.string().max(2000).nullable().optional(), agentId: id.optional(), newAgentWorkspaceId: id.optional(), newWorkspaceProjectId: id.optional(), ...confirm }),
165
+ input: z.strictObject({ kind: reportKindSchema.optional(), text: z.string().max(8000).optional(), error: z.string().max(2000).nullable().optional(), agentId: id.optional(), newAgentWorkspaceId: id.optional(), newWorkspaceProjectId: id.optional(), workspaceId: id.nullable().optional(), ...confirm }),
166
166
  guard: (a, caller) => {
167
167
  if (a.confirm) return null;
168
168
  if (!a.kind || a.text === undefined) return "report_send: give kind (bug, feature or feedback) and text (the developer's words).";
package/server/daemon.ts CHANGED
@@ -36,6 +36,7 @@ import { traceDaemon } from "./request-trace";
36
36
  import type { TurnTimeline } from "./turn-timeline";
37
37
  import { PASEO_UNREACHABLE, deliveryReceipt } from "../shared/queue";
38
38
  import type { Delivered } from "./message-queue";
39
+ import { paseoShowsLive } from "../shared/reopen";
39
40
  type RecoveryAgentOptions = Partial<PluginBeforeRequests["agent.create"]["config"]> & { workspaceId: string; labels: Record<string, string>; idempotencyKey: string; env: Record<string, string>; /** Paseo 0.16 (features.backgroundAgents): no tab, no notification, no sidebar row. */ background?: boolean };
40
41
 
41
42
  /**
@@ -495,6 +496,17 @@ export class PaseoGateway implements Gateway {
495
496
  /** Settings → Agents → Wait for background jobs (index.server.ts sets it). Unset or unreadable: on (Unknown is not off). */
496
497
  waitForJobs?: () => Promise<boolean>;
497
498
  private async waitsForJobs(): Promise<boolean> { try { return (await this.waitForJobs?.()) ?? true; } catch { return true; } }
499
+ /**
500
+ * The archived workspaces Paseo shows live again (paseoShowsLive): listed, or with their main agent unarchived. From
501
+ * the directory's rows only (no daemon request beyond its due re-read), so the engine's pass over archived workspaces
502
+ * costs nothing per workspace. Invariant 111.
503
+ */
504
+ async reopenable(ws: readonly Workspace[]): Promise<string[]> {
505
+ if (!ws.length) return [];
506
+ const rows = await this.directory.read();
507
+ const index = agentIndex(rows.agents);
508
+ return ws.filter(w => paseoShowsLive(w.id, rows.workspaces.find(row => row.id === w.id), index.byId.get(w.mainAgentId))).map(w => w.id);
509
+ }
498
510
  async observe(w: Workspace, fresh = false): Promise<Runtime> {
499
511
  const [rows, compacting, pauses] = await Promise.all([this.directory.read(fresh ? { fresh: "agents" } : {}), this.compacting(w.mainAgentId), this.guard.read()]);
500
512
  const { agents, workspaces } = rows;
@@ -505,7 +517,10 @@ export class PaseoGateway implements Gateway {
505
517
  if (taskIds.length) this.directory.lookup(taskIds);
506
518
  const taskAgents = taskIds.length ? taskAgentStates(taskIds, this.directory.withArchived(taskIds, taskIds.flatMap(id => index.byId.get(id) ?? []))) : {};
507
519
  const workspace = workspaces.find(row => row.id === w.id);
508
- if (!workspace || workspace.archivingAt) return { taskAgents, busy: false, reason: "Workspace is archived", archived: true };
520
+ if (workspace?.archivingAt) return { taskAgents, busy: false, reason: "Workspace is archived", archived: true };
521
+ // An archived workspace record whose main agent Paseo unarchived (the developer prompted it) is live again
522
+ // (paseoShowsLive, invariant 111); only Paseo's list of unarchived agents is read for it.
523
+ if (!workspace && !paseoShowsLive(w.id, workspace, index.byId.get(w.mainAgentId))) return { taskAgents, busy: false, reason: "Workspace is archived", archived: true };
509
524
  const a = index.byId.get(w.mainAgentId) ?? await this.connect(client => this.directory.live(client, w.mainAgentId));
510
525
  if (!a || a.archivedAt || a.workspaceId !== w.id) return { taskAgents, busy: false, reason: "Main agent is unavailable or moved to another workspace", archived: false };
511
526
  const recoveryIds = new Set(w.batches.filter(b => b.tasks.every(t => t.kind === "inventory")).flatMap(b => [b.recipientAgentId, ...b.recoveryHandoffs.map(h => h.fromAgentId)]));
@@ -515,7 +530,7 @@ export class PaseoGateway implements Gateway {
515
530
  const guarded = this.guard.waiting(pauses, { agentIds: [w.mainAgentId, ...scoped.map(agent => agent.id)], workspaceId: w.id, excludedAgentIds: [...recoveryIds].filter((id): id is string => !!id) });
516
531
  const guardedInterruptionId = this.guard.ownsInterruption(pauses, w.mainAgentId, w.interruption)?.id;
517
532
  const context = { guardedInterruptionId, mainTurnId: turnIdOf(a.activeTurn), mainTitle: a.title?.trim() || null };
518
- if (guarded || !pauses && workspace.labels?.some(label => /^(Paused|Paused by Session Guard)$/i.test(label))) return { taskAgents, ...context, guarded: true, busy: false, mainBusy: "guard", reason: "Waiting for Session Guard to resume this workspace", archived: false };
533
+ if (guarded || !pauses && workspace?.labels?.some(label => /^(Paused|Paused by Session Guard)$/i.test(label))) return { taskAgents, ...context, guarded: true, busy: false, mainBusy: "guard", reason: "Waiting for Session Guard to resume this workspace", archived: false };
519
534
  if (compacting) return { taskAgents, busy: true, mainBusy: "compacting", reason: "Smart Session is compacting the main agent", archived: false };
520
535
  const mainLoaded = isLoaded(a), mainRecent = recentlyUsed(a, this.windowMs, this.now());
521
536
  if (conversationGone(a.lastError)) return { taskAgents, busy: false, reason: a.lastError ?? "Conversation not found", archived: false, gone: a.lastError ?? "Conversation not found", mainLoaded, mainRecent };
@@ -232,7 +232,9 @@ export class DaemonDirectory {
232
232
  // Lifecycle events. Each patches what it knows; anything it can't know (titles, message times) waits for the
233
233
  // next due re-read.
234
234
  turnStarted(agent: HookAgent, turnId: string | null): void {
235
- this.patch(agent.id, a => { a.status = "running"; a.activeTurn = { id: turnId }; if (agent.title) a.title = agent.title; });
235
+ // A turn runs only on an agent Paseo unarchived (a prompt unarchives it, with no event of its own).
236
+ this.archived.delete(agent.id);
237
+ this.patch(agent.id, a => { a.status = "running"; a.activeTurn = { id: turnId }; a.archivedAt = null; if (agent.title) a.title = agent.title; });
236
238
  this.dirty = true;
237
239
  }
238
240
  turnEnded(agent: HookAgent, outcome: { kind: string }): void {
package/server/engine.ts CHANGED
@@ -20,6 +20,7 @@ import type { MessageQueue, Resolution, Target } from "./message-queue";
20
20
  import type { ImageRef } from "../shared/images";
21
21
  import { PASEO_UNREACHABLE, deliveryOf, type NewQueueItem, type QueueItem, type QueueItemInput } from "../shared/queue";
22
22
  import { recordSnapshot } from "./deployment-anchor";
23
+ import { askRefusal } from "../shared/reopen";
23
24
  import { pruneUnsent } from "./batch-archive";
24
25
  import { holdSuperseded, liftHold } from "../shared/status";
25
26
  import { agentAnswered, DEFAULT_MAX_AUTO_SENDS, runningAutoTurns, changedNotGone, conditionId, holdsQueue, inProgressHolds, IN_PROGRESS_MAX_MS, isCapped, MAIN_WAIT, movedOnReason, personHeld, personPart, QUIET_WAIT, readSince, repairWait, sendDecision, settleUnacknowledged, stillApplies, stuckRepair, UNACKNOWLEDGED_MS, type MainWait } from "../shared/send-decision";
@@ -68,6 +69,8 @@ export interface Gateway {
68
69
  rowBadges?(): Promise<boolean>;
69
70
  /** A tick begins: the gateway may list agents once for it (a-send-lists-agents-at-most-once-per-tick). */
70
71
  tickStarted?(): void;
72
+ /** Of these archived workspaces, the ids Paseo shows live again (shared/reopen.ts paseoShowsLive). */
73
+ reopenable?(ws: readonly Workspace[]): Promise<string[]>;
71
74
  }
72
75
 
73
76
  /**
@@ -267,7 +270,8 @@ export class Engine {
267
270
  this.lastDiscovery = { rows: rowsKey, state: await this.store.snapshot(), at: fresh ? this.now() : lastDiscovery!.at };
268
271
  }
269
272
  // Dormant workspaces stay listed but cost nothing: no PR or agent observation until they're active again.
270
- const current = await this.store.snapshot();
273
+ let current = await this.store.snapshot();
274
+ if (this.gateway.reopenable && current.workspaces.some(w => w.enable_tracking && w.archived) && await this.reopenArchived(current)) current = await this.store.snapshot();
271
275
  const active = current.workspaces.filter(w => w.enable_tracking && !w.archived && !w.dormant);
272
276
  // The developer's Refresh of a dormant workspace still reads its PRs (only its PRs: no agent observation, repairs or
273
277
  // sends). Before 2.0.1-beta.2 it read nothing, so a stale PR error there outlived every Refresh.
@@ -425,6 +429,21 @@ export class Engine {
425
429
  if (this.checkWatches) await this.checkWatches.evaluate(affected).catch(error => console.warn(`[follow-up] couldn't check the waits for checks: ${error instanceof Error ? error.message : String(error)}`));
426
430
  if (this.scheduledTasks && !this.stopped) await this.scheduledTasks.evaluate(affected).catch(error => console.warn(`[follow-up] couldn't send the scheduled tasks: ${error instanceof Error ? error.message : String(error)}`));
427
431
  }
432
+ /**
433
+ * Archived is Paseo's state, never a latch (invariant 111, shared/reopen.ts): a tracked workspace Follow-up reads as
434
+ * archived that Paseo shows live again (unarchived, or its main agent unarchived by a prompt) is followed again,
435
+ * whatever path missed it (a turn start lost to a reload, an unarchive in Paseo's sidebar).
436
+ */
437
+ private async reopenArchived(state: State): Promise<boolean> {
438
+ const archived = state.workspaces.filter(w => w.enable_tracking && w.archived);
439
+ if (!archived.length || !this.gateway.reopenable) return false;
440
+ const ids = await this.gateway.reopenable(archived).catch(() => [] as string[]);
441
+ for (const id of ids) await this.store.mutateWorkspace(id, w => { if (w.archived) { w.archived = false; w.updatedAt = new Date(this.now()).toISOString(); } });
442
+ if (ids.length) this.reopened?.(ids.map(id => findWorkspace(state, id).mainAgentId));
443
+ return ids.length > 0;
444
+ }
445
+ /** Main agents whose workspace the engine reopened: the worker reopens their Needs-you rows. */
446
+ reopened: ((agentIds: string[]) => void) | null = null;
428
447
  /**
429
448
  * A nudge's discovery (a-nudge-costs-its-workspace): only the nudged workspaces and their dirty agents (the kept turn
430
449
  * read, else a read of that agent), each applied with a one-workspace mutation. 2026-11-13 (run Y, the CI live shape): every turn end's nudge ran
@@ -997,12 +1016,19 @@ export function ownedWorkspace(state: State, agentId: string, workspaceId?: stri
997
1016
  requireTracking(w, agentId);
998
1017
  return w;
999
1018
  }
1000
- export function agentWorkspace(state: State, agentId: string, access: "read" | "write" = "write", workspaceId?: string, scope: "owner" | "pr" = "owner"): Workspace {
1019
+ /**
1020
+ * The workspace an agent's tool acts on. A write in a workspace Follow-up reads as archived is refused with why and
1021
+ * what to call (askRefusal, invariant 111): it would record a task, question or PR no surface shows. The worker
1022
+ * reopens a workspace Paseo shows live before this runs (callerWorkspaceId); `reopens` is enroll_workspace's own path.
1023
+ */
1024
+ export function agentWorkspace(state: State, agentId: string, access: "read" | "write" = "write", workspaceId?: string, scope: "owner" | "pr" = "owner", reopens = false): Workspace {
1001
1025
  const w = relatedWorkspace(state, agentId, workspaceId);
1002
1026
  const recovery = w?.batches.some(b => b.recipientAgentId === agentId && isRecovery(b) && (access === "read" || ["sending", "sent", "uncertain"].includes(b.state) || b.state === "blocked" && !b.settledAt));
1003
1027
  const contributor = scope === "pr" && w?.enable_tracking && !w.archived && w.contributorAgentIds?.includes(agentId);
1004
1028
  if (!w || (w.mainAgentId !== agentId && !recovery && !contributor)) throw accessError(w, agentId, access, workspaceId);
1005
1029
  if (access === "write") requireTracking(w, agentId);
1030
+ const refused = access === "write" && !reopens ? askRefusal(w) : null;
1031
+ if (refused) throw new Error(refused);
1006
1032
  return w;
1007
1033
  }
1008
1034
 
package/server/inbox.ts CHANGED
@@ -463,7 +463,8 @@ export class Inbox {
463
463
  // A developer's /compact asks for a compaction, not an answer: the ask stays open (a-compaction-is-not-a-finish).
464
464
  const answers = sender === "tom" && !isCompactCommand(prompt.message?.text);
465
465
  const brief: BriefEvent = answers ? { type: "message", text: prompt.message?.text ?? null } : { type: "turn_start" };
466
- await this.apply([{ agentId: root.rootId, event: { type: "message", from: answers ? "tom" : "automation" }, brief: () => brief }]);
466
+ // A turn runs only once Paseo has unarchived the agent, so its start reopens an archived row (shared/reopen.ts).
467
+ await this.apply([...await this.reopening(root.rootId, true), { agentId: root.rootId, event: { type: "message", from: answers ? "tom" : "automation" }, brief: () => brief }]);
467
468
  }
468
469
 
469
470
  async turnEnded(agent: { id: string; workspaceId: string | null; parentAgentId?: string | null }, outcome: { kind: "completed" } | { kind: "failed"; error: { message: string } } | { kind: "canceled"; reason: string }, turnId: string | null): Promise<void> {
@@ -471,6 +472,9 @@ export class Inbox {
471
472
  if (!await this.on()) return;
472
473
  if (await this.background(agent.id)) return;
473
474
  const root = await this.root(agent);
475
+ // A turn whose start this worker missed (a reload) still reopens the row, once Paseo shows the agent unarchived:
476
+ // a turn the archive itself ended leaves it archived.
477
+ if (!root.subagent) await this.apply(await this.reopening(root.rootId, false));
474
478
  if (root.subagent) {
475
479
  // Subagent finishes are covered by the parent's own turn end; failures surface on the parent's brief.
476
480
  if (outcome.kind === "failed") {
@@ -590,6 +594,26 @@ export class Inbox {
590
594
  await this.apply([{ agentId: root.rootId, event: { type: "crash", detail }, brief: await this.creator(root.rootId, null, ":closed", "error", { error: { message: detail } }) }]);
591
595
  }
592
596
 
597
+ /**
598
+ * The reopen event for an archived (gone) row whose agent is live again; nothing for a row that isn't gone. `live`:
599
+ * the caller knows the agent runs (a turn start, its own tool call), else Paseo's snapshot decides. Invariant 111.
600
+ */
601
+ private async reopening(agentId: string, live: boolean): Promise<{ agentId: string; event: InboxEvent }[]> {
602
+ if (!(await this.store.snapshot()).entries[agentId]?.goneAt) return [];
603
+ if (!live) {
604
+ const agent = await this.o.directory.agent(agentId).catch(() => null);
605
+ if (!agent || agent.archivedAt) return [];
606
+ }
607
+ return [{ agentId, event: { type: "reopen" } }];
608
+ }
609
+
610
+ /** The agent asked something (needs_you): it is running, so its archived row reopens and the ask shows. */
611
+ async reopen(agentId: string): Promise<boolean> {
612
+ const events = await this.reopening(agentId, true);
613
+ await this.apply(events);
614
+ return events.length > 0;
615
+ }
616
+
593
617
  async archived(agentIds: string[]): Promise<void> {
594
618
  const state = await this.store.snapshot();
595
619
  agentIds = agentIds.filter(id => state.entries[id]);
@@ -297,9 +297,9 @@ export const mcpSource: string = [
297
297
  " // Report an issue (server/report-issue/): one short line here; the procedure comes back from the first call, so it",
298
298
  " // costs context only while someone reports (report-issue-costs-no-standing-context). Matches reportToolDescription and",
299
299
  " // reportToolProperties (tests/report-issue-tool.test.ts).",
300
- " [\"report_issue\", \"Report a bug, feature request or feedback about Follow-up to its GitHub. Call with kind+summary first; the reply has the procedure.\", \"follow.agent-act\", { kind: { type: \"string\", enum: [\"bug\", \"feature\", \"feedback\"] }, summary: string, fields: { type: \"object\" }, planId: string, confirm: boolean, screenshot_consent: boolean }, []],",
300
+ " [\"report_issue\", \"Report a bug, feature request or feedback about Follow-up to its GitHub. Call with kind+summary first; the reply has the procedure.\", \"follow.agent-act\", { kind: { type: \"string\", enum: [\"bug\", \"feature\", \"feedback\"] }, summary: string, fields: { type: \"object\" }, planId: string, confirm: boolean, screenshot_consent: boolean, workspace_id: string }, []],",
301
301
  " // Report an issue's Send (follow.report-issue-send): the sheet's targets are follow.report-issue-targets' answer.",
302
- " [\"report_send\", \"Hand the developer's report to an agent (agentId), a new agent (newAgentWorkspaceId) or a new workspace (newWorkspaceProjectId), like Report an issue's Send.\" + ask, \"follow.agent-act\", { kind: { type: \"string\", enum: [\"bug\", \"feature\", \"feedback\"] }, text: string, error: string, agentId: string, newAgentWorkspaceId: string, newWorkspaceProjectId: string, ...planned }, []],",
302
+ " [\"report_send\", \"Hand the developer's report to an agent (agentId), a new agent (newAgentWorkspaceId) or a new workspace (newWorkspaceProjectId), like Report an issue's Send; workspaceId names the workspace it's about.\" + ask, \"follow.agent-act\", { kind: { type: \"string\", enum: [\"bug\", \"feature\", \"feedback\"] }, text: string, error: string, agentId: string, newAgentWorkspaceId: string, newWorkspaceProjectId: string, workspaceId: string, ...planned }, []],",
303
303
  "];",
304
304
  "// The Overseer's routing tools (1.4.0-beta.0): only in the session Follow-up started as its Overseer.",
305
305
  "const overseerTools = [",
package/server/mcp.mjs CHANGED
@@ -160,9 +160,9 @@ const actionTools = [
160
160
  // Report an issue (server/report-issue/): one short line here; the procedure comes back from the first call, so it
161
161
  // costs context only while someone reports (report-issue-costs-no-standing-context). Matches reportToolDescription and
162
162
  // reportToolProperties (tests/report-issue-tool.test.ts).
163
- ["report_issue", "Report a bug, feature request or feedback about Follow-up to its GitHub. Call with kind+summary first; the reply has the procedure.", "follow.agent-act", { kind: { type: "string", enum: ["bug", "feature", "feedback"] }, summary: string, fields: { type: "object" }, planId: string, confirm: boolean, screenshot_consent: boolean }, []],
163
+ ["report_issue", "Report a bug, feature request or feedback about Follow-up to its GitHub. Call with kind+summary first; the reply has the procedure.", "follow.agent-act", { kind: { type: "string", enum: ["bug", "feature", "feedback"] }, summary: string, fields: { type: "object" }, planId: string, confirm: boolean, screenshot_consent: boolean, workspace_id: string }, []],
164
164
  // Report an issue's Send (follow.report-issue-send): the sheet's targets are follow.report-issue-targets' answer.
165
- ["report_send", "Hand the developer's report to an agent (agentId), a new agent (newAgentWorkspaceId) or a new workspace (newWorkspaceProjectId), like Report an issue's Send." + ask, "follow.agent-act", { kind: { type: "string", enum: ["bug", "feature", "feedback"] }, text: string, error: string, agentId: string, newAgentWorkspaceId: string, newWorkspaceProjectId: string, ...planned }, []],
165
+ ["report_send", "Hand the developer's report to an agent (agentId), a new agent (newAgentWorkspaceId) or a new workspace (newWorkspaceProjectId), like Report an issue's Send; workspaceId names the workspace it's about." + ask, "follow.agent-act", { kind: { type: "string", enum: ["bug", "feature", "feedback"] }, text: string, error: string, agentId: string, newAgentWorkspaceId: string, newWorkspaceProjectId: string, workspaceId: string, ...planned }, []],
166
166
  ];
167
167
  // The Overseer's routing tools (1.4.0-beta.0): only in the session Follow-up started as its Overseer.
168
168
  const overseerTools = [
@@ -39,6 +39,13 @@ export type ReportPluginConfig = {
39
39
  diagnostics: () => Promise<Diagnostics>;
40
40
  /** What to redact: repository names and titles the plugin knows. Hostname and home are added here. */
41
41
  redaction?: () => Promise<RedactionContext>;
42
+ /**
43
+ * Optional: what the report is about (a workspace, a document), passed by the agent as `param` (e.g. "workspace_id").
44
+ * `read(id)`: `local` goes only to the reporting agent, to diagnose with; `section` (structural rows: states, counts,
45
+ * timings, codes) is the only part that reaches the issue, redacted again; `privateTitles` join this report's
46
+ * redaction list. Null: no such subject.
47
+ */
48
+ subject?: { param: string; read: (id: string) => Promise<{ local: Record<string, unknown>; section: DiagnosticsSection; privateTitles?: readonly string[] } | null> };
42
49
  /** Reads a screenshot (tests inject one). */
43
50
  readFile?: (path: string) => Promise<Buffer>;
44
51
  now?: () => number;
@@ -75,6 +82,7 @@ export const reportInputSchema = z.strictObject({
75
82
  confirm: z.boolean().optional(),
76
83
  screenshot_consent: z.boolean().optional(),
77
84
  });
85
+ const subjectId = z.string().trim().min(1).max(200);
78
86
  export type ReportInput = z.infer<typeof reportInputSchema>;
79
87
 
80
88
  /** The tool's JSON schema, for MCP registration (kept beside the zod one; a test checks they agree). */
@@ -86,12 +94,16 @@ export const reportToolProperties = {
86
94
  confirm: { type: "boolean" },
87
95
  screenshot_consent: { type: "boolean" },
88
96
  } as const;
97
+ /** The tool's properties with the subject's parameter, for a plugin that has one. */
98
+ export const reportToolPropertiesFor = (subjectParam?: string) => subjectParam ? { ...reportToolProperties, [subjectParam]: { type: "string" } } : reportToolProperties;
89
99
 
90
100
  const IMAGE = new Map([[".png", "png"], [".jpg", "jpg"], [".jpeg", "jpg"], [".gif", "gif"], [".webp", "webp"]]);
91
101
  const MAX_IMAGE = 10 * 1024 * 1024;
92
102
  const PLAN_TTL = 20 * 60_000;
93
103
  const FIELDS: (keyof ReportFields)[] = ["title", "what_happened", "steps", "expected", "actual", "problem", "proposal", "alternatives", "feedback", "context", "findings"];
94
104
 
105
+ type Subject = { id: string; local: Record<string, unknown>; section: DiagnosticsSection; privateTitles?: readonly string[] };
106
+
95
107
  type Plan = {
96
108
  id: string; caller: string; expiresAt: number;
97
109
  kind: ReportKind; title: string; labels: string[]; fields: ReportFields; diagnostics: string;
@@ -109,17 +121,28 @@ export class Reporter {
109
121
 
110
122
  /** One tool call. `caller` is the agent, from the host (never an argument): a plan runs only for the agent that made it. */
111
123
  async run(caller: string, raw: unknown): Promise<Record<string, unknown>> {
112
- const parsed = reportInputSchema.safeParse(raw ?? {});
124
+ const param = this.c.subject?.param;
125
+ const { [param ?? "\0"]: rawSubject, ...rest } = (raw ?? {}) as Record<string, unknown>;
126
+ const parsed = reportInputSchema.safeParse(param ? rest : raw ?? {});
113
127
  if (!parsed.success) throw new Error(`${this.c.toolName}: ${parsed.error.issues.map(i => `${i.path.join(".") || "arguments"} ${i.message}`).join("; ")}`);
114
128
  const a = parsed.data;
129
+ const sid = param && rawSubject !== undefined ? subjectId.safeParse(rawSubject) : null;
130
+ if (sid && !sid.success) throw new Error(`${this.c.toolName}: ${param} must be an id.`);
115
131
  if (a.confirm) return this.confirm(caller, a);
116
132
  if (!a.kind) throw new Error(`${this.c.toolName}: give kind (bug, feature or feedback) and a one-line summary first.`);
117
- if (!a.fields || !Object.keys(a.fields).length) return this.procedure(a.kind, a.summary);
118
- return this.dryRun(caller, a.kind, a.fields);
133
+ const about = sid?.success ? await this.subject(sid.data) : null;
134
+ if (!a.fields || !Object.keys(a.fields).length) return this.procedure(a.kind, a.summary, about);
135
+ return this.dryRun(caller, a.kind, a.fields, about);
136
+ }
137
+
138
+ private async subject(id: string) {
139
+ const got = await this.c.subject!.read(id);
140
+ if (!got) throw new Error(`${this.c.toolName}: ${this.c.name} knows nothing as ${this.c.subject!.param}=${id}. Check the id, or leave ${this.c.subject!.param} out to report without it.`);
141
+ return { id, ...got };
119
142
  }
120
143
 
121
144
  /** Call 1: the whole procedure, only now that someone is reporting. */
122
- procedure(k: ReportKind, summary?: string) {
145
+ procedure(k: ReportKind, summary?: string, about: Subject | null = null) {
123
146
  const t = this.c.toolName;
124
147
  const fields = (list: readonly (keyof ReportFields)[]) => Object.fromEntries(list.map(f => [f, FIELD_HELP[f]]));
125
148
  return {
@@ -139,17 +162,24 @@ export class Reporter {
139
162
  `7. Only after an explicit yes to filing: call ${t} with confirm=true, the planId, and screenshot_consent=true or false. Never file without that yes; ${this.c.repo} is public.`,
140
163
  `8. Give them the link. If the images weren't uploaded, ask them to drag them into the issue at that link.`,
141
164
  ],
142
- next: `Interview the developer, then call ${t} with kind="${k}" and fields.`,
165
+ ...(about ? { subject: {
166
+ id: about.id,
167
+ local: about.local,
168
+ issueGets: about.section.rows,
169
+ note: `local is for you to diagnose with and stays on this machine. ${this.c.repo} is public: never copy names, titles or text from local into the fields. The issue gets only the issueGets rows (for a bug), added and redacted by ${t}. Pass ${this.c.subject!.param}="${about.id}" on every call.`,
170
+ } } : {}),
171
+ next: `Interview the developer, then call ${t} with kind="${k}"${about ? `, ${this.c.subject!.param}="${about.id}"` : ""} and fields.`,
143
172
  };
144
173
  }
145
174
 
146
- private async redactor(allow: string[]): Promise<Redactor> {
175
+ private async redactor(allow: string[], extraTitles: readonly string[] = []): Promise<Redactor> {
147
176
  const base = await this.c.redaction?.().catch(() => ({} as RedactionContext)) ?? {};
148
177
  const candidates = [...new Set([...(base.privateRepos ?? []), ...(base.publicRepos ?? [])])].filter(r => r.toLowerCase() !== this.c.repo.toLowerCase());
149
178
  const pub = await publicRepos(this.c.github, candidates, this.visibility, this.now()).catch(() => new Set<string>());
150
179
  const host = hostname();
151
180
  return new Redactor({
152
181
  ...base,
182
+ privateTitles: [...(base.privateTitles ?? []), ...extraTitles],
153
183
  hostnames: [...(base.hostnames ?? []), host],
154
184
  home: base.home ?? homedir(),
155
185
  privateRepos: candidates.filter(r => !pub.has(r.toLowerCase())),
@@ -158,8 +188,9 @@ export class Reporter {
158
188
  });
159
189
  }
160
190
 
161
- private async diagnostics(k: ReportKind, r: Redactor): Promise<string> {
162
- const d = await this.c.diagnostics().catch((error: unknown): Diagnostics => ({ sections: [{ title: "Diagnostics", level: "versions", rows: [["Error", `couldn't collect: ${error instanceof Error ? error.message : String(error)}`]] }] }));
191
+ private async diagnostics(k: ReportKind, r: Redactor, extra: DiagnosticsSection | null = null): Promise<string> {
192
+ const got = await this.c.diagnostics().catch((error: unknown): Diagnostics => ({ sections: [{ title: "Diagnostics", level: "versions", rows: [["Error", `couldn't collect: ${error instanceof Error ? error.message : String(error)}`]] }] }));
193
+ const d: Diagnostics = extra ? { ...got, sections: [...got.sections, extra] } : got;
163
194
  const clean: Diagnostics = { sections: d.sections.map(s => ({ ...s, title: r.text(s.title), rows: s.rows.map(([a, b]) => [r.text(a), r.text(b)] as [string, string]) })), logs: d.logs?.map(l => r.text(l)) };
164
195
  return renderDiagnostics(k, clean, { plugin: this.c.name });
165
196
  }
@@ -179,19 +210,19 @@ export class Reporter {
179
210
  }
180
211
 
181
212
  /** Call 2: refuse with what's missing, or plan the issue. Reads only (invariant `report-issue-files-only-after-confirm`). */
182
- private async dryRun(caller: string, k: ReportKind, a: z.infer<typeof reportFieldsSchema>) {
213
+ private async dryRun(caller: string, k: ReportKind, a: z.infer<typeof reportFieldsSchema>, about: Subject | null = null) {
183
214
  const fields: ReportFields = Object.fromEntries(FIELDS.filter(f => a[f] !== undefined).map(f => [f, a[f]]));
184
215
  const missing = missingFields(k, fields);
185
216
  if (missing.required.length) {
186
217
  return { stage: "missing", kind: k, missing: missing.required, help: Object.fromEntries(missing.required.map(f => [f, FIELD_HELP[f]])), next: `Ask the developer for ${missing.required.join(", ")}, then call ${this.c.toolName} again with kind and every field in fields. Nothing was filed.` };
187
218
  }
188
- const r = await this.redactor(a.allow_names ?? []);
219
+ const r = await this.redactor(a.allow_names ?? [], about?.privateTitles ?? []);
189
220
  const clean = r.deep(fields);
190
221
  const title = r.text(fields.title).slice(0, 120);
191
222
  const shots = await this.screenshots(a.screenshots ?? []);
192
223
  if (shots.problems.length) throw new Error(`${this.c.toolName}: ${shots.problems.join("; ")}. Fix the paths or leave those screenshots out.`);
193
224
  const descriptions = shots.out.map(s => ({ ...s, description: r.text(s.description) }));
194
- const block = await this.diagnostics(k, r);
225
+ const block = await this.diagnostics(k, r, about?.section ?? null);
195
226
  const comment = a.comment_on ? await existingIssue(this.c.github, this.c.repo, a.comment_on).catch((e: unknown) => { throw new Error(`${this.c.toolName}: ${e instanceof Error ? e.message : String(e)}`); }) : null;
196
227
  const duplicates: Duplicate[] = comment ? [] : await findDuplicates(this.c.github, this.c.repo, title).catch(() => []);
197
228
  const date = new Date(this.now()).toISOString().slice(0, 10);
@@ -1,7 +1,8 @@
1
1
  import { Reporter, environment, manualIssueLink, type Diagnostics, type DiagnosticsSection, type ReportKind, type ReportPluginConfig } from "./report-issue";
2
2
  import type { LogRing } from "./report-issue/diagnostics";
3
3
  import type { RestSend } from "./github-api";
4
- import type { State } from "../shared/model";
4
+ import { summary, type State, type Workspace } from "../shared/model";
5
+ import { checksState } from "../shared/pr-status";
5
6
  import type { Resources } from "../shared/resources";
6
7
  import type { UpdatesView } from "../shared/updates";
7
8
 
@@ -26,6 +27,8 @@ export type FollowUpReportDeps = {
26
27
  /** Whether native tools are served (Paseo's agent MCP) or the stdio bridge. */
27
28
  toolTransport: () => string;
28
29
  startedAt: number;
30
+ /** A workspace's agents from the directory (metadata only; never loads one), for a report about that workspace. */
31
+ agents?: (workspaceId: string) => Promise<{ id: string; title: string | null; provider: string; status: string }[]>;
29
32
  now?: () => number;
30
33
  };
31
34
 
@@ -77,6 +80,7 @@ async function redaction(d: FollowUpReportDeps) {
77
80
  const s = await d.snapshot().catch(() => null);
78
81
  const repos = new Set<string>(); const titles = new Set<string>();
79
82
  for (const w of s?.workspaces ?? []) {
83
+ if (w.repo) repos.add(w.repo);
80
84
  for (const p of w.prs) { repos.add(p.repo); if (p.snapshot?.title) titles.add(p.snapshot.title); }
81
85
  if (w.title) titles.add(w.title);
82
86
  if (w.goal) titles.add(w.goal);
@@ -84,6 +88,81 @@ async function redaction(d: FollowUpReportDeps) {
84
88
  return { privateRepos: [...repos], privateTitles: [...titles] };
85
89
  }
86
90
 
91
+ const count = <T>(list: readonly T[], key: (x: T) => string) => {
92
+ const m = new Map<string, number>();
93
+ for (const x of list) m.set(key(x), (m.get(key(x)) ?? 0) + 1);
94
+ return [...m].map(([k, n]) => `${n} ${k}`).join(", ") || "none";
95
+ };
96
+ const age = (iso: string | undefined, now: number) => { const t = iso ? Date.parse(iso) : NaN; return Number.isFinite(t) ? `${ago(Math.max(0, now - t))} ago` : "unknown"; };
97
+ /** An error's code, never its words: "RATE_LIMIT", "HTTP 502", else "error". */
98
+ const errorCode = (e: string) => /\b[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+\b/.exec(e)?.[0] ?? /\bHTTP \d{3}\b|\b[45]\d\d\b/.exec(e)?.[0] ?? "error";
99
+
100
+ /**
101
+ * A report about one workspace (subject-is-structural-only, invariant 154). `local` is Follow-up's view of it for the
102
+ * reporting agent to diagnose with, and stays on this machine. `section` is all the public issue gets: states, counts,
103
+ * timings, check and conflict states and error codes, built from structure only, so no title, goal, summary, task or
104
+ * question text, branch or repository name can reach it. `privateTitles` adds the workspace's own text to the
105
+ * redaction list, in case the agent quotes it in a field.
106
+ */
107
+ export async function workspaceSubject(d: FollowUpReportDeps, workspaceId: string) {
108
+ const s = await d.snapshot().catch(() => null);
109
+ const w = s?.workspaces.find(x => x.id === workspaceId);
110
+ if (!w) return null;
111
+ const now = (d.now ?? Date.now)();
112
+ const agents = await d.agents?.(workspaceId).catch(() => []) ?? [];
113
+ const logs = d.logs.recent(40).filter(l => l.includes(workspaceId));
114
+ return { local: workspaceLocal(w, agents, logs, now), section: workspaceSection(w, agents, logs, now), privateTitles: workspaceTexts(w) };
115
+ }
116
+
117
+ function workspaceLocal(w: Workspace, agents: { id: string; title: string | null; provider: string; status: string }[], logs: string[], now: number) {
118
+ const st = summary(w, now);
119
+ return {
120
+ workspaceId: w.id, title: w.title, goal: w.goal, status: `${st.status}: ${st.label}${st.reason ? ` (${st.reason})` : ""}`,
121
+ following: w.enable_tracking, autoSend: w.enable_auto_sends, hold: w.hold, archived: w.archived, sendWait: w.sendWait ?? null, mainBusy: w.mainBusy ?? null,
122
+ prs: w.prs.map(p => ({ pr: `${p.repo}#${p.number}`, title: p.snapshot?.title ?? null, state: p.snapshot?.state ?? "unknown", draft: p.snapshot?.draft ?? null,
123
+ checks: p.snapshot ? checksState(p.snapshot) : "unknown", conflict: p.snapshot?.conflict ?? null, review: p.snapshot?.reviewDecision ?? null, error: p.error, observed: age(p.snapshot?.observedAt, now) })),
124
+ tasks: w.obligations.map(o => ({ id: o.id, title: o.title, status: o.status })),
125
+ questions: w.questions.filter(q => !q.closed && !q.answer).map(q => ({ id: q.id, title: q.title, question: q.question })),
126
+ batches: w.batches.slice(-10).map(b => ({ id: b.id, state: b.state, tasks: b.tasks.length })),
127
+ agents: agents.map(a => ({ ...a, main: a.id === w.mainAgentId })),
128
+ recentWarnings: logs,
129
+ };
130
+ }
131
+
132
+ function workspaceSection(w: Workspace, agents: { id: string; provider: string; status: string }[], logs: string[], now: number) {
133
+ const st = summary(w, now);
134
+ const snaps = w.prs.map(p => p.snapshot).filter(x => !!x);
135
+ const open = snaps.filter(p => p.state === "OPEN");
136
+ const rows: [string, string][] = [
137
+ ["Status", `${st.status} · following ${w.enable_tracking ? "on" : "off"} · Auto-send ${w.enable_auto_sends ? "on" : "off"}${w.hold ? " · on hold" : ""}${w.archived ? " · archived" : ""}${w.sendWait ? ` · repairs wait: ${w.sendWait}` : ""}${w.mainBusy ? ` · main agent: ${w.mainBusy}` : ""}`],
138
+ ["PRs", `${w.prs.length} (${count(w.prs, p => (p.snapshot?.state ?? "unknown").toLowerCase())})${open.length ? ` · ${open.filter(p => p.draft).length} draft` : ""}`],
139
+ ];
140
+ if (open.length) {
141
+ rows.push(["Checks (open PRs)", count(open, p => checksState(p))]);
142
+ rows.push(["Conflicts (open PRs)", String(open.filter(p => p.conflict).length)]);
143
+ rows.push(["Reviews (open PRs)", count(open, p => (p.reviewDecision || "none").toLowerCase())]);
144
+ rows.push(["Workflow", count(open, p => p.prWorkflow ?? "graphite")]);
145
+ }
146
+ const errors = w.prs.filter(p => p.error);
147
+ if (errors.length) rows.push(["PR refresh errors", count(errors, p => errorCode(p.error!))]);
148
+ if (snaps.length) rows.push(["Last PR read", age(snaps.map(p => p.observedAt).sort().at(-1), now)]);
149
+ rows.push(["Tasks", count(w.obligations, o => o.status)]);
150
+ rows.push(["Questions", `${w.questions.filter(q => !q.closed && !q.answer).length} open · ${w.questions.filter(q => q.answer).length} answered · ${w.questions.filter(q => q.closed).length} closed`]);
151
+ if (w.batches.length) rows.push(["Repair batches", count(w.batches, b => b.state)]);
152
+ rows.push(["Agents", agents.length ? `${agents.length} (${count(agents, a => a.provider)}) · main ${agents.find(a => a.id === w.mainAgentId)?.status ?? "unknown"}` : `${1 + (w.contributorAgentIds?.length ?? 0)} (from Follow-up's record)`]);
153
+ if (w.completion) rows.push(["Done", `declared ${age(w.completion.declaredAt, now)}`]);
154
+ if (logs.length) rows.push(["Recent warnings about it", `${logs.length} (${count(logs, l => errorCode(l))})`]);
155
+ return { title: "This workspace", level: "state" as const, rows };
156
+ }
157
+
158
+ /** Every bit of the workspace's own text, for the redaction list: never in the section, and replaced if quoted. */
159
+ function workspaceTexts(w: Workspace): string[] {
160
+ return [w.id, w.title, w.goal, w.completion?.summary, w.declaration?.summary,
161
+ ...w.prs.flatMap(p => [p.snapshot?.title, p.snapshot?.headBranch, p.snapshot?.head, p.stack]),
162
+ ...w.obligations.flatMap(o => [o.title, o.evidence]),
163
+ ...w.questions.flatMap(q => [q.title, q.question, q.background, q.big])].filter((x): x is string => typeof x === "string" && !!x.trim());
164
+ }
165
+
87
166
  export function followUpReportConfig(d: FollowUpReportDeps): ReportPluginConfig {
88
167
  return {
89
168
  name: "Follow-up", repo: REPORT_REPO, toolName: `follow_${REPORT_TOOL}`, assetsFolder: "follow-up",
@@ -93,6 +172,7 @@ export function followUpReportConfig(d: FollowUpReportDeps): ReportPluginConfig
93
172
  return { sections: [versions, env, state], logs: d.logs.recent(20) };
94
173
  },
95
174
  redaction: () => redaction(d),
175
+ subject: { param: "workspace_id", read: id => workspaceSubject(d, id) },
96
176
  now: d.now,
97
177
  };
98
178
  }
@@ -108,13 +188,14 @@ export function followUpReporter(d: FollowUpReportDeps) {
108
188
  }
109
189
 
110
190
  /** What the sheet sends to the agent it picked. The words name the tool so the agent takes it from there. */
111
- export function reportPrompt(kind: ReportKind, text: string, error?: string | null): string {
191
+ export function reportPrompt(kind: ReportKind, text: string, error?: string | null, workspaceId?: string | null): string {
112
192
  const what = kind === "bug" ? "a bug" : kind === "feature" ? "a feature request" : "feedback";
113
193
  const lines = [
114
194
  `Report ${what} about Follow-up for me: ${text.trim() || "(I'll describe it when you ask.)"}`,
115
195
  ...(error ? [``, `The error I saw: ${error.trim()}`] : []),
116
196
  ``,
117
- `Use the follow_report_issue tool (call it with kind="${kind}" and a one-line summary first; it returns the steps). Ask me for anything it needs, and show me the exact issue before filing it.`,
197
+ ...(workspaceId ? [`It's about the Follow-up workspace ${workspaceId}. Pass workspace_id="${workspaceId}" on every follow_report_issue call: the first reply gives you Follow-up's view of it to diagnose with. That view stays local; the public issue gets only its structural rows.`, ``] : []),
198
+ `Use the follow_report_issue tool (call it with kind="${kind}"${workspaceId ? `, workspace_id="${workspaceId}"` : ""} and a one-line summary first; it returns the steps). Ask me for anything it needs, and show me the exact issue before filing it.`,
118
199
  ];
119
200
  return lines.join("\n");
120
201
  }
@@ -13,7 +13,7 @@ import { reportWorkspaceTitle, type ReportKind } from "../shared/report-send";
13
13
  * call is refused, so the developer is never offered a start the host would turn down. Follow-up then tracks the new
14
14
  * workspace through the project's normal follow settings; nothing here enrolls it.
15
15
  */
16
- export type ReportSendInput = { kind: ReportKind; text: string; error?: string | null; agentId?: string; newAgentWorkspaceId?: string; newWorkspaceProjectId?: string };
16
+ export type ReportSendInput = { kind: ReportKind; text: string; error?: string | null; agentId?: string; newAgentWorkspaceId?: string; newWorkspaceProjectId?: string; /** The workspace the report is about (the panel's ⋯ entry): the prompt names it. */ workspaceId?: string | null };
17
17
  /** `queued`: handed to an existing agent through the message queue (sent in the background, retried until it lands). */
18
18
  export type ReportSendResult = { agentId: string; title: string; started: boolean; workspaceId?: string; queued?: boolean };
19
19
  type AgentHandle = { id: string };
@@ -46,8 +46,8 @@ export function newWorkspaceTarget(rows: DirectoryRows | null, workspaceId: stri
46
46
  export const agentTitleFor = (kind: ReportKind) => kind === "bug" ? "Report a Follow-up bug" : kind === "feature" ? "Follow-up feature request" : "Follow-up feedback";
47
47
 
48
48
  export async function sendReport(d: ReportSendDeps, input: ReportSendInput): Promise<ReportSendResult> {
49
- const { kind, text, error, agentId, newAgentWorkspaceId, newWorkspaceProjectId } = input;
50
- const prompt = reportPrompt(kind, text, error);
49
+ const { kind, text, error, agentId, newAgentWorkspaceId, newWorkspaceProjectId, workspaceId } = input;
50
+ const prompt = reportPrompt(kind, text, error, workspaceId);
51
51
  if (agentId) {
52
52
  await d.sendTo(agentId, prompt, randomUUID());
53
53
  return { agentId, title: (await d.agentTitle(agentId).catch(() => null)) ?? "the agent", started: false, queued: true };
@@ -23,9 +23,10 @@ export function agentTrackedWorkspace(state: State, agentId: string): Workspace
23
23
 
24
24
  /**
25
25
  * A turn started: a newer main-agent turn lifts the stopped turn's automatic hold (holdSuperseded), a turn in an owned
26
- * workspace ends its Done, and a turn in a dormant workspace makes it active again. Returns the workspaces to nudge.
26
+ * workspace ends its Done, the main agent's turn reopens its archived workspace, and a turn in a dormant workspace
27
+ * makes it active again. Returns the workspaces to nudge.
27
28
  */
28
- export async function turnStarted(store: Store, agent: { id: string; workspaceId: string | null }, turnId: string | null): Promise<{ lifted: string[]; owned: string | null; woken: string | null }> {
29
+ export async function turnStarted(store: Store, agent: { id: string; workspaceId: string | null }, turnId: string | null): Promise<{ lifted: string[]; owned: string | null; woken: string | null; reopened: string | null }> {
29
30
  const saved = await store.snapshot();
30
31
  const turn = { agentId: agent.id, turnId };
31
32
  const owned = agentTrackedWorkspace(saved, agent.id);
@@ -35,8 +36,12 @@ export async function turnStarted(store: Store, agent: { id: string; workspaceId
35
36
  const lifted: string[] = [];
36
37
  for (const w of held) await store.mutateWorkspace(w.id, current => { if (current.enable_tracking && holdSuperseded(current, turn)) { liftHold(current); lifted.push(current.id); } });
37
38
  if (owned && (owned.completion || owned.declaration)) await store.mutateWorkspace(owned.id, w => { w.completion = null; w.declaration = null; });
39
+ // A turn runs only on an agent Paseo unarchived (a prompt unarchives it, and Paseo sends no event for that): the main
40
+ // agent's turn reopens the workspace Follow-up read as archived (invariant 111, shared/reopen.ts).
41
+ const reopened = owned?.archived && owned.mainAgentId === agent.id ? owned.id : null;
42
+ if (reopened) await store.mutateWorkspace(reopened, w => { if (w.archived && w.mainAgentId === agent.id) { w.archived = false; w.updatedAt = new Date().toISOString(); } });
38
43
  if (waking) await store.mutateWorkspace(waking.id, w => { delete w.dormant; });
39
- return { lifted, owned: owned?.id ?? null, woken: waking?.id ?? null };
44
+ return { lifted, owned: owned?.id ?? null, woken: waking?.id ?? null, reopened };
40
45
  }
41
46
 
42
47
  /**
@@ -389,7 +389,7 @@ export const reportTargetsRpc = defineRpc({ name: "follow.report-issue-targets",
389
389
  // The project a new workspace would start in (server/report-send.ts); null without one or without the host feature.
390
390
  newWorkspace: z.object({ projectId: idSchema, title: z.string() }).nullable().optional() }) });
391
391
  /** Send to agent: the report prompt goes to `agentId`, a new agent in `newAgentWorkspaceId`, or a new workspace in `newWorkspaceProjectId`. */
392
- export const reportSendRpc = defineRpc({ name: "follow.report-issue-send", input: z.object({ kind: reportKindSchema, text: z.string().max(8000), error: z.string().max(2000).nullable().optional(), agentId: z.string().max(200).optional(), newAgentWorkspaceId: z.string().max(200).optional(), newWorkspaceProjectId: z.string().max(200).optional() }),
392
+ export const reportSendRpc = defineRpc({ name: "follow.report-issue-send", input: z.object({ kind: reportKindSchema, text: z.string().max(8000), error: z.string().max(2000).nullable().optional(), agentId: z.string().max(200).optional(), newAgentWorkspaceId: z.string().max(200).optional(), newWorkspaceProjectId: z.string().max(200).optional(), /** The workspace the report is about; its prompt names it for follow_report_issue's workspace_id. */ workspaceId: z.string().max(200).nullable().optional() }),
393
393
  output: z.object({ agentId: idSchema, title: z.string(), started: z.boolean(), workspaceId: z.string().optional(), queued: z.boolean().optional() }) });
394
394
  /** Open on GitHub (no agent to send to): a prefilled new-issue link carrying the redacted versions block. */
395
395
  export const reportLinkRpc = defineRpc({ name: "follow.report-issue-link", input: z.object({ kind: reportKindSchema, text: z.string().max(8000) }), output: z.object({ url: z.string() }) });
package/shared/inbox.ts CHANGED
@@ -149,6 +149,12 @@ export type InboxEvent =
149
149
  | { type: "open" }
150
150
  | { type: "archive" }
151
151
  | { type: "unarchive" }
152
+ /**
153
+ * The agent is live again (a turn of its own, a needs_you call): Paseo unarchives an agent when it is prompted and
154
+ * sends no event for it, so its activity reopens the row whatever the archive's age. A flag from before a keep that
155
+ * ran out is stale and goes. Invariant 111, an-ask-from-a-live-agent-reaches-the-developer (shared/reopen.ts).
156
+ */
157
+ | { type: "reopen" }
152
158
  | { type: "set_finish_flags"; value: boolean }
153
159
  | { type: "reconcile"; detail: string };
154
160
 
@@ -430,6 +436,11 @@ export function reduce(prev: Entry, event: InboxEvent, now: string): Entry {
430
436
  case "open": break; // #17: opening, reading, switching away and Paseo's read state change nothing.
431
437
  case "archive": if (!e.goneAt) e.goneAt = now; break; // #18
432
438
  case "unarchive": if (e.goneAt && Date.parse(now) - Date.parse(e.goneAt) <= GONE_MS) e.goneAt = null; break;
439
+ case "reopen":
440
+ if (!e.goneAt) break;
441
+ if (Date.parse(now) - Date.parse(e.goneAt) > GONE_MS) { e.needs = null; e.snooze = null; }
442
+ e.goneAt = null;
443
+ break;
433
444
  case "set_finish_flags": e.enable_finish_flags = event.value; break;
434
445
  case "reconcile": // #20
435
446
  if (e.enable_finish_flags) flag("finished", event.detail, "finished");
@@ -0,0 +1,65 @@
1
+ // A one-line field's placeholder always fits on its one line (`a-placeholder-never-wraps`, AGENTS.md invariant 153).
2
+ // React Native on Android draws a single-line TextInput's placeholder as a wrapping hint: one too long for the field
3
+ // breaks onto a second line that the one-line field clips (React Native issue 14839, open since 2017). A web <input>
4
+ // clips it mid-word instead. So the field never hands the platform a placeholder wider than its text room: it takes
5
+ // the longest of the field's wordings that fits, else the shortest cut after its last whole word that fits with "…",
6
+ // else none. A hint is never cut inside a word: "Sear…" says less than no hint.
7
+
8
+ /** Each wording, preferred (longest) first; one string is a single wording. */
9
+ export type Placeholder = string | readonly string[];
10
+
11
+ export const placeholderWordings = (p: Placeholder): readonly string[] => (typeof p === "string" ? [p] : p);
12
+ /** The full wording: the field's accessible name whatever wording is shown. */
13
+ export const fullPlaceholder = (p: Placeholder): string => placeholderWordings(p)[0] ?? "";
14
+
15
+ // Advance widths in em, rounded up from Roboto (Android's system sans), which runs wider than SF and Inter: an
16
+ // estimate where the platform offers no measure (native). Better a word shorter than a clipped line.
17
+ const NARROW = new Set([..."iljI.,:;'!|"]);
18
+ const SEMI = new Set([..."tfr()[]-/ "]);
19
+ const WIDE = new Set([..."mwMW@%"]);
20
+ /** Width of `text` in px at `fontSize` px: an upper estimate for the system sans. */
21
+ export function estimateTextWidth(text: string, fontSize: number, letterSpacing = 0): number {
22
+ let em = 0;
23
+ for (const ch of text) {
24
+ em += NARROW.has(ch) ? 0.27 : SEMI.has(ch) ? 0.36 : WIDE.has(ch) ? 0.9 : ch === "…" ? 0.8 : /[A-Z]/.test(ch) ? 0.7 : 0.58;
25
+ }
26
+ return em * fontSize * 1.05 + letterSpacing * [...text].length;
27
+ }
28
+
29
+ /**
30
+ * The wording to show in `room` px of text width: the first that fits, else the last cut after a whole word with "…"
31
+ * ("Filter, or paste…"), else "". Before the field has a width (`room` null) it is `before`: the full wording by
32
+ * default, the one the field asked for.
33
+ */
34
+ export function fitPlaceholder(p: Placeholder, room: number | null, measure: (text: string) => number, before: "full" | "shortest" = "full"): string {
35
+ const all = placeholderWordings(p);
36
+ if (!all.length) return "";
37
+ if (room === null || !Number.isFinite(room)) return before === "full" ? all[0]! : all[all.length - 1]!;
38
+ for (const w of all) if (measure(w) <= room) return w;
39
+ const words = all[all.length - 1]!.split(/(?<=\s)/);
40
+ for (let n = words.length - 1; n > 0; n--) {
41
+ const cut = `${words.slice(0, n).join("").trimEnd().replace(/[,;:–—-]+$/, "")}…`;
42
+ if (measure(cut) <= room) return cut;
43
+ }
44
+ return "";
45
+ }
46
+
47
+ type Style = Record<string, unknown>;
48
+ const num = (v: unknown): number | undefined => (typeof v === "number" && Number.isFinite(v) ? v : undefined);
49
+ /**
50
+ * The horizontal text room of a field `width` px wide with this flattened style: its width less its left and right
51
+ * padding. `nativeDefault` is the platform's own padding where the style sets none (Android's EditText has some).
52
+ */
53
+ export function textRoom(width: number, style: Style, nativeDefault = 0): number {
54
+ const side = (...keys: string[]) => { for (const k of keys) { const v = num(style[k]); if (v !== undefined) return v; } return nativeDefault; };
55
+ return width - side("paddingLeft", "paddingStart", "paddingHorizontal", "padding") - side("paddingRight", "paddingEnd", "paddingHorizontal", "padding")
56
+ - (num(style.borderLeftWidth) ?? num(style.borderWidth) ?? 0) - (num(style.borderRightWidth) ?? num(style.borderWidth) ?? 0);
57
+ }
58
+
59
+ /** The font size the platform draws: the style's (React Native's default 14) times the system font scale, capped. */
60
+ export function drawnFontSize(style: Style, fontScale: number, opts: { allowFontScaling?: boolean; maxFontSizeMultiplier?: number | null } = {}): number {
61
+ const size = num(style.fontSize) ?? 14;
62
+ if (opts.allowFontScaling === false) return size;
63
+ const cap = opts.maxFontSizeMultiplier && opts.maxFontSizeMultiplier >= 1 ? opts.maxFontSizeMultiplier : Infinity;
64
+ return size * Math.min(Math.max(fontScale || 1, 1 / 4), cap);
65
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Archived is Paseo's state, never a latch Follow-up keeps (invariant 111, `an-ask-from-a-live-agent-reaches-the-developer`).
3
+ *
4
+ * Paseo archives a workspace with its agents, and unarchives an agent when anyone prompts it, but leaves the workspace
5
+ * record archived and sends no event for either unarchive. So Follow-up reads a workspace as live when Paseo lists it
6
+ * (not mid-archive) or, with its record still archived, when its main agent is unarchived in it: the developer is
7
+ * talking to that agent again. Every path that can see this (a main-agent turn, a needs_you or other write tool call,
8
+ * the engine's pass over archived workspaces) reopens the workspace and its Needs-you row. Where Paseo still has the
9
+ * workspace archived, a tool that would record an ask nobody sees refuses with this module's text instead of
10
+ * answering ok. 2026-11-25: a Done, archived workspace's agent got new scope in chat and called needs_you
11
+ * kind=decision twice; nothing reached the developer and the agent heard no error.
12
+ */
13
+
14
+ /** Paseo's workspace row as the directory lists it; absent once the workspace record is archived. */
15
+ export type PaseoWorkspaceRow = { archivingAt?: string | null } | null | undefined;
16
+ /** The main agent's Paseo snapshot (Paseo's own agent list leaves archived agents out). */
17
+ export type PaseoMainAgent = { archivedAt?: string | null; workspaceId?: string | null } | null | undefined;
18
+
19
+ /** Whether Paseo shows the workspace live: listed and not being archived, or its main agent unarchived in it. */
20
+ export function paseoShowsLive(workspaceId: string, row: PaseoWorkspaceRow, main: PaseoMainAgent): boolean {
21
+ if (row) return !row.archivingAt;
22
+ return !!main && !main.archivedAt && main.workspaceId === workspaceId;
23
+ }
24
+
25
+ /** The error a write tool gives when Paseo still has the caller's workspace archived: why, and what to call. */
26
+ export function archivedAskError(workspaceId: string): string {
27
+ return `Workspace ${workspaceId} is archived in Paseo, so Follow-up isn't following it and nothing recorded here would reach the developer. Call needs_you kind=decision at the turn's end with your ask, and ask the developer to unarchive the workspace in Paseo.`;
28
+ }
29
+
30
+ /** needs_you's note when Paseo still has the workspace archived: the ask reaches Needs you, Follow-up's tracking doesn't. */
31
+ export const ARCHIVED_NEEDS_YOU_NOTE = "This workspace is archived in Paseo. Your ask still reaches the developer's Needs you, but Follow-up doesn't follow the workspace's PRs or tasks until the developer unarchives it: say so in your reply.";
32
+
33
+ /** What a write tool may do in a workspace: null when it acts, else the refusal it answers with. */
34
+ export function askRefusal(w: { id: string; archived: boolean }): string | null {
35
+ return w.archived ? archivedAskError(w.id) : null;
36
+ }
37
+
38
+ /** One workspace as Follow-up and Paseo each read it, for the invariant. */
39
+ export type ReopenRow = { workspaceId: string; mainAgentId: string; archived: boolean; inboxGone: boolean; paseoLive: boolean };
40
+
41
+ /**
42
+ * `an-ask-from-a-live-agent-reaches-the-developer`: a workspace Paseo shows live is never archived in Follow-up and
43
+ * its main agent's Needs-you row is never gone, so the agent's asks show. (A Done workspace goes back to working on
44
+ * the main agent's next turn: turn-events.ts turnStarted.)
45
+ */
46
+ export function reopenViolations(rows: readonly ReopenRow[]): { id: string; detail: string }[] {
47
+ const id = "an-ask-from-a-live-agent-reaches-the-developer";
48
+ return rows.filter(r => r.paseoLive && (r.archived || r.inboxGone)).map(r => ({ id,
49
+ detail: `${r.workspaceId} is live in Paseo but Follow-up ${r.archived ? "reads it archived" : `hides ${r.mainAgentId}'s Needs-you row`}` }));
50
+ }
@@ -50,7 +50,15 @@ export function pickerRows(t: SendTargets): { pinned: PickerRow[]; agents: Picke
50
50
  }
51
51
 
52
52
  /** What Send goes to before the developer picks: today's rule, unchanged. */
53
- export function defaultChoice(t: SendTargets): string | null { return t.defaultId ?? (t.newAgentWorkspace ? NEW_AGENT : null); }
53
+ /**
54
+ * The default pick: the best agent, else a new agent. A report about a workspace (`about`) starts a new agent in that
55
+ * workspace instead, so the agent the workspace depends on isn't pulled into diagnosing Follow-up; with no workspace
56
+ * to start one in, the best agent as usual.
57
+ */
58
+ export function defaultChoice(t: SendTargets, about: string | null = null): string | null {
59
+ if (about && t.newAgentWorkspace?.id === about) return NEW_AGENT;
60
+ return t.defaultId ?? (t.newAgentWorkspace ? NEW_AGENT : null);
61
+ }
54
62
 
55
63
  /**
56
64
  * A report's new workspace: "<Kind>: <first words>", at most 60 characters, cut at a word with "…". The words are the
@@ -69,3 +77,14 @@ export function reportWorkspaceTitle(kind: ReportKind, text: string, error?: str
69
77
  const words = (space > room / 2 ? cut.slice(0, space) : cut).replace(/[\s,;:.!?-]+$/, "");
70
78
  return `${prefix}${words}…`;
71
79
  }
80
+
81
+ /**
82
+ * The workspace a report is about (the row menu's Report a bug…), while it applies: only for a bug
83
+ * ("if needed": an idea or feedback isn't about one workspace's state) and until the developer removes it. Its id goes
84
+ * with Send, and the agent reads that workspace's Follow-up state locally; the public issue gets only structural rows.
85
+ */
86
+ export function reportAbout(request: { about?: string | null }, kind: "bug" | "feature" | "feedback", removed: boolean): string | null {
87
+ return request.about && kind === "bug" && !removed ? request.about : null;
88
+ }
89
+ /** The About line's words: what goes where, in one breath. */
90
+ export const ABOUT_LINE = "The agent reads this workspace's Follow-up state. The issue gets only its counts and states, never its titles or text.";
@@ -38,6 +38,7 @@ export const ROW_ACTIONS = {
38
38
  unpin: { tool: "pin_workspace", note: "pinned=false." },
39
39
  make_main: { tool: "make_main_agent" },
40
40
  stop_following: { tool: "set_follow_settings" },
41
+ report: { tool: "report_issue", note: "workspace_id=<id>; the developer's report goes to an agent through report_send with workspaceId, as the sheet's Send does." },
41
42
  archive: { exempt: "Paseo's own archive_workspace tool archives a workspace for an agent; this item sends Paseo that same request." },
42
43
  } as const satisfies Record<string, { tool: string; note?: string } | { exempt: string }>;
43
44
  export type RowActionId = keyof typeof ROW_ACTIONS;
@@ -218,6 +219,9 @@ export function rowMenu(input: RowMenuInput): RowMenuSection[] {
218
219
  confirm: `Stop following ${s.title}? Follow-up keeps its history, and you can follow it again in Settings → Following.` },
219
220
  !archiveFirst && archiveItem,
220
221
  ]);
222
+
223
+ // 6. Report a bug about this workspace (invariant 154): the Report sheet, already about it. Last, out of the way.
224
+ add("report", [!!s.workspaceId && { key: "report", action: "report", label: "Report a bug…", icon: "Bug" }]);
221
225
  return sections;
222
226
  }
223
227
 
@@ -31,6 +31,8 @@ import { GONE_REASON } from "./queue";
31
31
  import { taskSchedule } from "./task-trigger";
32
32
  import { taskDue } from "./task-due";
33
33
  import { taskViewRows } from "./task-view";
34
+ import { askRefusal } from "./reopen";
35
+ export { reopenViolations } from "./reopen";
34
36
 
35
37
  /**
36
38
  * Status invariants: what must hold for any workspace, whatever path changed it. Pure, no IO, and never throwing:
@@ -67,6 +69,16 @@ export const INVARIANTS: Invariant[] = [
67
69
  return null;
68
70
  },
69
71
  },
72
+ {
73
+ id: "an-ask-from-a-live-agent-reaches-the-developer",
74
+ why: "2026-11-25: an archived, Done workspace's agent was unarchived and given new scope in chat; its needs_you kind=decision calls reached nobody and answered ok. A workspace Follow-up reads as archived refuses every write tool with why and what to call (askRefusal); one it follows accepts them. reopenViolations checks the other half: a workspace Paseo shows live is never read as archived, nor its main agent's row gone.",
75
+ check(w) {
76
+ const refused = askRefusal(w);
77
+ if (w.archived && !refused) return `${w.id} is archived but a write tool would record an ask there and answer ok`;
78
+ if (!w.archived && refused) return `${w.id} is followed but write tools refuse it as archived`;
79
+ return null;
80
+ },
81
+ },
70
82
  {
71
83
  id: "a-person-part-is-a-person-item",
72
84
  why: "2026-11-23 (batch-churn renders): the agent answered that one review thread needed the reviewer's call, then the review changed and the update asked the agent to fix every thread again, with nothing in Needs you about the person's part. A part the agent's latest answer says only a person can move (Batch.waitingOn) is a person item while its PR is open.",