paseo-follow-up 2.2.0 → 2.2.1-beta.1
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/README.md +2 -0
- package/client/catch-up.tsx +19 -3
- package/client/dictation.tsx +95 -0
- package/client/home.tsx +26 -1
- package/client/needs-you.tsx +12 -2
- package/client/questions.tsx +12 -3
- package/client/tasks.tsx +8 -5
- package/docs/screenshots/follow-up-questions.png +0 -0
- package/docs/screenshots/follow-up-setup.png +0 -0
- package/index.server.ts +4 -2
- package/package.json +1 -1
- package/server/agent-actions.ts +5 -2
- package/server/agent-hook.mjs +1 -1
- package/server/daemon.ts +28 -13
- package/server/engine.ts +53 -11
- package/server/hook-source.ts +1 -1
- package/server/mcp-source.ts +4 -4
- package/server/mcp.mjs +4 -4
- package/shared/activity.ts +3 -1
- package/shared/attention.ts +28 -4
- package/shared/catch-up.ts +5 -3
- package/shared/contracts.ts +1 -1
- package/shared/dictation.ts +75 -0
- package/shared/headline.ts +1 -0
- package/shared/model.ts +18 -3
- package/shared/send-decision.ts +82 -4
- package/shared/status-invariants.ts +38 -3
- package/shared/task-rows.ts +3 -3
package/shared/send-decision.ts
CHANGED
|
@@ -39,6 +39,38 @@ const iso = (ms: number) => new Date(ms).toISOString();
|
|
|
39
39
|
/** The reason the settle gives: why "in a minute" and not now (Tom, 2026-11-12: "sending in a moment? why not now?"). */
|
|
40
40
|
export const SETTLE_REASON = "waits a minute so new changes join the same message";
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Why a repair waits on the main agent itself, said the same on every surface and in the queue (Q96 = A). Only the
|
|
44
|
+
* main agent's own work holds a repair: never another agent in the workspace, never a subagent.
|
|
45
|
+
*/
|
|
46
|
+
export const MAIN_WAIT = {
|
|
47
|
+
turn: "sends when the main agent's turn ends, so it isn't interrupted",
|
|
48
|
+
jobs: "sends when the main agent's background job ends (Wait for background jobs is on)",
|
|
49
|
+
permission: "sends once the main agent's permission prompt is answered",
|
|
50
|
+
guard: "sends when Session Guard resumes the main agent",
|
|
51
|
+
compacting: "sends when Smart Session finishes compacting the main agent",
|
|
52
|
+
} as const;
|
|
53
|
+
export type MainWait = keyof typeof MAIN_WAIT;
|
|
54
|
+
/** Auto-send is off for the workspace: the repair waits for the developer's Send. */
|
|
55
|
+
export const AUTO_OFF_REASON = "Auto-send is off here, so it waits for your Send";
|
|
56
|
+
/**
|
|
57
|
+
* The main agent's own wait. A record no refresh has read yet (`mainBusy` absent) counts the workspace's busy as the
|
|
58
|
+
* main agent's: unknown is not off.
|
|
59
|
+
*/
|
|
60
|
+
export const mainWait = (w: Pick<Workspace, "mainBusy" | "runtimeBusy" | "backgroundBusy">): MainWait | null =>
|
|
61
|
+
repairWait({ busy: w.runtimeBusy, backgroundBusy: w.backgroundBusy, mainBusy: w.mainBusy });
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* What holds a repair: the main agent's own wait (Runtime.mainBusy, Q96 = A). A gateway that doesn't say (undefined)
|
|
65
|
+
* counts the workspace's busy as the main agent's: unknown is not off.
|
|
66
|
+
*/
|
|
67
|
+
export function repairWait(runtime: { busy: boolean; backgroundBusy?: boolean; mainBusy?: MainWait | null }): MainWait | null {
|
|
68
|
+
if (runtime.mainBusy !== undefined) return runtime.mainBusy;
|
|
69
|
+
return runtime.busy ? "turn" : runtime.backgroundBusy ? "jobs" : null;
|
|
70
|
+
}
|
|
71
|
+
/** The Done check reads whether all work is finished, so it alone still waits for every agent in the workspace. */
|
|
72
|
+
export const QUIET_WAIT = "waits until every agent in the workspace is done, so the check sees finished work";
|
|
73
|
+
|
|
42
74
|
/**
|
|
43
75
|
* The one auto-send rule (status invariant the-send-line-matches-the-send-decision). The worker's refresh sends the
|
|
44
76
|
* queued batch when, and only when, `send` is true; the batch line on every surface (shared/status.ts) and the Tasks
|
|
@@ -52,19 +84,21 @@ export function sendDecision(w: Workspace, now: number, o: { settleMs?: number;
|
|
|
52
84
|
// What the developer's own Send (Engine.sendPending/dispatch) refuses, checked in the same order.
|
|
53
85
|
const prUnread = b && needsPrObservations(w, b) ? w.prs.find(p => p.error || !p.snapshot?.complete) : undefined;
|
|
54
86
|
const openBatch = !!b && w.batches.some(x => x.id !== b.id && !recoveryBatch(x) && OPEN_BATCH_STATES.includes(x.state));
|
|
87
|
+
// The developer's Send is taken while the main agent is busy: it goes the moment the main agent is free (Q96).
|
|
55
88
|
const canSendNow = !!b && b.state === "pending" && !recoveryBatch(b) && !w.archived && w.enable_tracking && !w.hold && !w.goneAgent &&
|
|
56
|
-
!w.
|
|
89
|
+
(!w.runtimeReason || !!mainWait(w)) && !openBatch && !prUnread;
|
|
57
90
|
const wait = (waitingOn: SendDecision["waitingOn"], reason: string, eta: string | null = null): SendDecision => ({ send: false, waitingOn, reason, eta, canSendNow });
|
|
58
91
|
if (!b || b.state !== "pending" || recoveryBatch(b)) return wait(null, "nothing queued");
|
|
59
92
|
if (w.archived) return wait("you", "the workspace is archived");
|
|
60
93
|
if (!w.enable_tracking) return wait("you", "Follow-up isn't following this workspace");
|
|
61
94
|
// The Done check never goes out on its own (it would wake an idle agent for bookkeeping).
|
|
62
95
|
if (b.tasks.some(t => t.kind === "completion")) return wait("you", "ready to send");
|
|
63
|
-
if (!w.enable_auto_sends) return wait("you",
|
|
96
|
+
if (!w.enable_auto_sends) return wait("you", AUTO_OFF_REASON);
|
|
64
97
|
if (w.hold) return wait("you", "paused until you resume");
|
|
65
98
|
if (w.goneAgent) return wait("you", "the main agent's conversation is gone");
|
|
66
|
-
|
|
67
|
-
|
|
99
|
+
// Only the main agent's own work holds a repair (Q96 = A): a subagent or another agent at work never does.
|
|
100
|
+
const main = mainWait(w);
|
|
101
|
+
if (main) return wait("agent", MAIN_WAIT[main]);
|
|
68
102
|
if (w.runtimeReason) return wait("follow-up", w.runtimeReason);
|
|
69
103
|
if (openBatch) return wait("follow-up", "waits for the last message to finish");
|
|
70
104
|
if (w.dormant) return wait("you", "waits until the workspace is active again");
|
|
@@ -116,3 +150,47 @@ export function settleUnacknowledged(w: Workspace, b: Batch, open: readonly Task
|
|
|
116
150
|
b.result = !still.length ? "The turn ended without an acknowledgment; GitHub no longer shows these, so they're done."
|
|
117
151
|
: `The turn ended without an acknowledgment.${done ? ` ${done} done on GitHub.` : ""}${again ? ` ${again} still open ${again === 1 ? "goes" : "go"} in the next message.` : ""}${capped.length ? ` ${capped.length} sent ${NO_PROGRESS_CAP} times with no change ${capped.length === 1 ? "waits" : "wait"} for you.` : ""}`;
|
|
118
152
|
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The agent said only a person can move this condition (Batch.humanOnly) and it is still the same condition: it waits
|
|
156
|
+
* as the developer's held "person" task, never an agent failure and never sent again on its own. A changed condition
|
|
157
|
+
* (a new review, a new head) has a new fingerprint and goes out as usual. Invariant a-human-only-outcome-is-a-human-item.
|
|
158
|
+
*/
|
|
159
|
+
export const personHeld = (w: Pick<Workspace, "batches">, t: Pick<Task, "key" | "fingerprint">) => {
|
|
160
|
+
const id = conditionId(t);
|
|
161
|
+
return w.batches.some(b => b.state === "completed" && !!b.humanOnly && b.tasks.some(x => conditionId(x) === id));
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/** Blocked or unconfirmed: a repair batch whose outcome the developer is shown (Needs you's "The tasks didn't finish"). */
|
|
165
|
+
export const stuckRepair = (b: Pick<Batch, "state" | "tasks">) =>
|
|
166
|
+
["blocked", "uncertain"].includes(b.state) && !recoveryBatch(b) && !(b.tasks.length > 0 && b.tasks.every(t => t.kind === "completion"));
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Whether GitHub's answer for the task's PR is known (a complete snapshot and no read error), or the task isn't about a
|
|
170
|
+
* tracked PR (a task's own state is local). Unknown is not off: a PR GitHub didn't answer for still applies.
|
|
171
|
+
*/
|
|
172
|
+
function conditionKnown(w: Pick<Workspace, "prs">, t: Pick<Task, "kind" | "target">): boolean {
|
|
173
|
+
if (t.kind === "obligation") return true;
|
|
174
|
+
const pr = w.prs.find(p => p.key === t.target);
|
|
175
|
+
return !pr || !!pr.snapshot?.complete && !pr.error;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Whether a stuck repair batch still asks for anything: some task's condition (key and fingerprint) is still open in
|
|
180
|
+
* `open` (server/tasks.ts tasksFor, the PRs as they are now), or its PR's state is unknown. Once nothing applies (every
|
|
181
|
+
* PR merged or closed, the review dismissed or replaced, the checks passing, the conflict gone) the batch settles on its
|
|
182
|
+
* own, the same rule reconcile applies to a queued one. Invariant a-batch-item-leaves-once-nothing-applies.
|
|
183
|
+
*/
|
|
184
|
+
export function stillApplies(w: Pick<Workspace, "prs">, b: Pick<Batch, "tasks">, open: readonly Pick<Task, "key" | "fingerprint">[]): boolean {
|
|
185
|
+
const ids = new Set(open.map(conditionId));
|
|
186
|
+
return b.tasks.some(t => ids.has(conditionId(t)) || !conditionKnown(w, t));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Why a stuck batch that stopped mattering settled, in the developer's words ("No longer needed: #1 merged."). */
|
|
190
|
+
export function mootReason(w: Pick<Workspace, "prs">, b: Pick<Batch, "tasks">): string {
|
|
191
|
+
const prs = [...new Set(b.tasks.map(t => t.target))].map(key => w.prs.find(p => p.key === key)).filter(p => !!p);
|
|
192
|
+
const ended = prs.filter(p => p.snapshot?.state === "MERGED" || p.snapshot?.state === "CLOSED");
|
|
193
|
+
if (prs.length && ended.length === prs.length && ended.length === new Set(b.tasks.map(t => t.target)).size)
|
|
194
|
+
return `No longer needed: ${ended.map(p => `#${p.number} ${p.snapshot!.state === "MERGED" ? "merged" : "closed"}`).join(", ")}.`;
|
|
195
|
+
return "No longer needed: GitHub no longer shows what it asked for.";
|
|
196
|
+
}
|
|
@@ -13,7 +13,7 @@ import { asksForReviewers, liveLine, needsYou, type NeedItem } from "./attention
|
|
|
13
13
|
import { HOME_GROUPS, homeCounts, prChip, trackedGroup, type HomeModel } from "./home";
|
|
14
14
|
import { freshPriorities, type Priority } from "./priorities";
|
|
15
15
|
import { agentCard, automaticHold, batchView, holdSuperseded } from "./status";
|
|
16
|
-
import { conditionId, isCapped, NO_PROGRESS_CAP, sendDecision } from "./send-decision";
|
|
16
|
+
import { conditionId, isCapped, mainWait, NO_PROGRESS_CAP, personHeld, sendDecision, stuckRepair } from "./send-decision";
|
|
17
17
|
import { messageStrip, obligationDelivery, repairRows } from "./task-rows";
|
|
18
18
|
import { followUpObligations } from "./follow-up";
|
|
19
19
|
import { PRESENCE, claimsWorking, taskStatus } from "./task-status";
|
|
@@ -32,7 +32,6 @@ import { GONE_REASON } from "./queue";
|
|
|
32
32
|
*/
|
|
33
33
|
export type Invariant = { id: string; why: string; check(w: Workspace, now: number): string | null };
|
|
34
34
|
|
|
35
|
-
const idle = (w: Workspace) => !w.runtimeBusy && !w.backgroundBusy;
|
|
36
35
|
const inFlight = (w: Workspace) => w.batches.some(b => ["sending", "sent"].includes(b.state));
|
|
37
36
|
const lines = (w: Workspace, now: number) => [liveLine(w, now).text, agentCard(w, now)?.line ?? "", batchView(w, now)?.line ?? "", ...needsYou(w, now).flatMap(i => [i.title, "blocker" in i ? i.blocker ?? "" : ""])];
|
|
38
37
|
|
|
@@ -138,18 +137,54 @@ export const INVARIANTS: Invariant[] = [
|
|
|
138
137
|
for (const h of w.heldTasks ?? []) {
|
|
139
138
|
if (h.held === "capped" && !isCapped(w, h.task)) return `${h.task.key} is held as capped below ${NO_PROGRESS_CAP} sends`;
|
|
140
139
|
if (h.held === "manual" && !(w.manualTasks ?? []).includes(h.task.key)) return `${h.task.key} is held as manual without the developer's choice`;
|
|
140
|
+
if (h.held === "person" && !personHeld(w, h.task)) return `${h.task.key} is held for a person without the agent's human-only outcome`;
|
|
141
141
|
if (pending?.tasks.some(t => conditionId(t) === conditionId(h.task))) return `${h.task.key} is held and in the next message`;
|
|
142
142
|
}
|
|
143
143
|
return null;
|
|
144
144
|
},
|
|
145
145
|
},
|
|
146
|
+
{
|
|
147
|
+
id: "a-batch-item-leaves-once-nothing-applies",
|
|
148
|
+
why: "2026-11-18 (2.2.0): a repair batch the agent acknowledged blocked stayed in Needs you as \"The tasks didn't finish\" two hours after its only PR merged; a stuck batch never re-checked what it asked for, while a queued one did. A stuck batch settles once nothing it asked for still applies (every PR merged or closed, or each condition gone).",
|
|
149
|
+
check(w) {
|
|
150
|
+
if (!w.enable_tracking || w.archived) return null;
|
|
151
|
+
const ended = (key: string) => { const p = w.prs.find(p => p.key === key); return !!p && !p.error && !!p.snapshot?.complete && (p.snapshot.state === "MERGED" || p.snapshot.state === "CLOSED"); };
|
|
152
|
+
const moot = w.batches.find(b => stuckRepair(b) && b.tasks.every(t => t.kind !== "obligation" && ended(t.target)));
|
|
153
|
+
return moot ? `${moot.id} is ${moot.state} though every PR it was about has merged or closed` : null;
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
id: "a-human-only-outcome-is-a-human-item",
|
|
158
|
+
why: "2026-11-18 (2.2.0): the agent reported \"nothing for an agent to fix; needs the reviewer to re-review or dismiss\" and Needs you showed it as an agent failure (\"The tasks didn't finish\", Open main agent). Only a person can move it, so it is the developer's PR item, never a stuck batch.",
|
|
159
|
+
check(w, now) {
|
|
160
|
+
const stuck = w.batches.find(b => b.humanOnly && b.state !== "completed");
|
|
161
|
+
if (stuck) return `${stuck.id} is human-only but ${stuck.state}`;
|
|
162
|
+
const retry = needsYou(w, now).find(i => i.kind === "retry" && w.batches.find(b => b.id === i.batchId)?.humanOnly);
|
|
163
|
+
return retry ? `${retry.key} shows a human-only outcome as an agent failure` : null;
|
|
164
|
+
},
|
|
165
|
+
},
|
|
146
166
|
{
|
|
147
167
|
id: "no-sends-when-idle-claim", why: "2026-11-10 wks_4b27f268: \"sends when the agent is idle\" while the agent was idle and nothing would send",
|
|
148
168
|
check: (w, now) => lines(w, now).find(l => /sends when the agent is idle/i.test(l)) ?? null,
|
|
149
169
|
},
|
|
150
170
|
{
|
|
151
171
|
id: "waiting-on-agent-means-busy", why: "a queued batch may only blame the agent's turn while the agent is in one",
|
|
152
|
-
check: (w, now) => { const v = batchView(w, now); return v?.phase === "queued" && v.waitingOn === "agent" &&
|
|
172
|
+
check: (w, now) => { const v = batchView(w, now); return v?.phase === "queued" && v.waitingOn === "agent" && !mainWait(w) ? v.line : null; },
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
id: "a-repair-goes-to-a-free-main-agent",
|
|
176
|
+
why: "2026-11-18 (Q96 = A): a repair sat pending over two hours with Auto-send on and the main agent idle, because a subagent it started ran one task after another and every non-main agent's work held repairs; the card said nothing true. A repair waits only for the main agent itself (its turn, its own background job with Wait for background jobs on, a permission prompt, Session Guard, compaction), says what it waits for, and offers Send now while it does.",
|
|
177
|
+
check(w, now) {
|
|
178
|
+
const v = batchView(w, now);
|
|
179
|
+
if (v?.phase !== "queued" || v.kind !== "repairs") return null;
|
|
180
|
+
const d = sendDecision(w, now, { batch: v.batch });
|
|
181
|
+
if (d.waitingOn === "agent" && !mainWait(w)) return `"${d.reason}" while the main agent is free`;
|
|
182
|
+
// Send now is taken while the main agent is busy; only something else (an open message, unread PRs) refuses it.
|
|
183
|
+
if (d.waitingOn === "agent" && !d.canSendNow && sendDecision({ ...w, mainBusy: null, runtimeBusy: false, backgroundBusy: false, runtimeReason: null }, now, { batch: v.batch }).canSendNow)
|
|
184
|
+
return `waits on the main agent with no Send now: "${d.reason}"`;
|
|
185
|
+
if (!d.send && !d.reason.trim()) return "waits without saying why";
|
|
186
|
+
return null;
|
|
187
|
+
},
|
|
153
188
|
},
|
|
154
189
|
{
|
|
155
190
|
id: "on-it-means-sent", why: "2026-11-10 wks_4b27f268: \"Main agent is on it\" while the agent was idle and nothing had been sent",
|
package/shared/task-rows.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { sendDecision } from "./send-decision";
|
|
|
19
19
|
export const REPAIR_KINDS: readonly Task["kind"][] = ["conflict", "review", "checks", "restack"];
|
|
20
20
|
export const isRepair = (t: Pick<Task, "kind">) => REPAIR_KINDS.includes(t.kind);
|
|
21
21
|
|
|
22
|
-
export type RepairState = "queued" | "sent" | "capped" | "manual" | "done";
|
|
22
|
+
export type RepairState = "queued" | "sent" | "capped" | "manual" | "person" | "done";
|
|
23
23
|
export type RepairRow = {
|
|
24
24
|
task: Task;
|
|
25
25
|
state: RepairState;
|
|
@@ -84,14 +84,14 @@ export function repairRows(w: Workspace, doneLimit = 20): { open: RepairRow[]; d
|
|
|
84
84
|
const add = (task: Task, state: RepairState, text: string) => { if (!isRepair(task) || seen.has(task.key)) return; seen.add(task.key); open.push({ task, state, text, pr: prOf(task) }); };
|
|
85
85
|
for (const t of sentMessage(w)?.tasks ?? []) add(t, "sent", "Sent");
|
|
86
86
|
for (const t of pendingMessage(w)?.tasks ?? []) add(t, "queued", "Queued");
|
|
87
|
-
for (const h of w.heldTasks ?? []) add(h.task, h.held, h.held === "capped" ? "Needs you · sent twice, no change on GitHub" : "Auto off · stays with you");
|
|
87
|
+
for (const h of w.heldTasks ?? []) add(h.task, h.held, h.held === "capped" ? "Needs you · sent twice, no change on GitHub" : h.held === "person" ? "Needs you · waits on a person, not the agent" : "Auto off · stays with you");
|
|
88
88
|
const done: RepairRow[] = [];
|
|
89
89
|
// Newest settled message first; a task key still open (another fingerprint) isn't done.
|
|
90
90
|
const settled = w.batches.filter(b => b.state === "completed" && b.sentAt && message(b)).sort((a, b) => Date.parse(b.settledAt ?? b.sentAt!) - Date.parse(a.settledAt ?? a.sentAt!));
|
|
91
91
|
for (const b of settled) for (const t of b.tasks) {
|
|
92
92
|
if (!isRepair(t) || seen.has(t.key) || done.length >= doneLimit) continue;
|
|
93
93
|
seen.add(t.key);
|
|
94
|
-
done.push({ task: t, state: "done", text: b.unacknowledged ? "Done · resolved on GitHub" : `Done · ${agent(w)} finished it`, at: b.settledAt, pr: prOf(t) });
|
|
94
|
+
done.push({ task: t, state: "done", text: b.unacknowledged || b.humanOnly ? "Done · resolved on GitHub" : `Done · ${agent(w)} finished it`, at: b.settledAt, pr: prOf(t) });
|
|
95
95
|
}
|
|
96
96
|
return { open, done };
|
|
97
97
|
}
|