paseo-follow-up 2.7.0-beta.2 → 2.7.0-beta.3
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/package.json +1 -1
- package/server/engine.ts +14 -6
- package/server/mcp-source.ts +1 -1
- package/server/mcp.mjs +1 -1
- package/server/tasks.ts +8 -7
- package/shared/model.ts +6 -0
- package/shared/send-decision.ts +54 -5
- package/shared/status-invariants.ts +13 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paseo-follow-up",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.7.0-beta.
|
|
4
|
+
"version": "2.7.0-beta.3",
|
|
5
5
|
"description": "Every agent, one inbox. Follow-up brings what all your coding agents need from you into one ranked list, and follows their work through merge, deploy and after.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
package/server/engine.ts
CHANGED
|
@@ -23,7 +23,7 @@ import { recordSnapshot } from "./deployment-anchor";
|
|
|
23
23
|
import { askRefusal } from "../shared/reopen";
|
|
24
24
|
import { pruneUnsent } from "./batch-archive";
|
|
25
25
|
import { holdSuperseded, liftHold } from "../shared/status";
|
|
26
|
-
import { agentAnswered, autoSentLastHour, autoTurnsPerHour, 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";
|
|
26
|
+
import { agentAnswered, autoSentLastHour, autoTurnsPerHour, DEFAULT_MAX_AUTO_SENDS, runningAutoTurns, changedNotGone, conditionId, holdsQueue, inProgressHolds, IN_PROGRESS_MAX_MS, isCapped, MAIN_WAIT, movedOnReason, personHeld, personPart, QUIET_WAIT, readSince, repairWait, sendDecision, settleGoneParts, settleUnacknowledged, stillApplies, stuckRepair, UNACKNOWLEDGED_MS, type MainWait } from "../shared/send-decision";
|
|
27
27
|
import { isRepair } from "../shared/task-rows";
|
|
28
28
|
import { outsideQuestions, parseOutsideId, type OutsideRun } from "../shared/outside-run";
|
|
29
29
|
import { dismissItem, undoDismissItem } from "./dismiss";
|
|
@@ -163,7 +163,7 @@ export class Engine {
|
|
|
163
163
|
}
|
|
164
164
|
// A batch left blocked or unconfirmed by a release before a-batch-item-leaves-once-nothing-applies, whose PRs
|
|
165
165
|
// have since merged or changed, settles at start-up, dormant workspaces included (no tick observes those).
|
|
166
|
-
if (w.enable_tracking && !w.archived) settleMoot(w, eligible, this.now());
|
|
166
|
+
if (w.enable_tracking && !w.archived) { settleMoot(w, eligible, this.now()); settleGoneParts(w); }
|
|
167
167
|
const healed = healBatches(w);
|
|
168
168
|
if (healed.restored || healed.relabelled || healed.duplicates) console.warn(`[follow-up] healed batches in ${w.id}: ${healed.restored} answered restored, ${healed.relabelled} relabelled as updated, ${healed.duplicates} duplicates set aside`);
|
|
169
169
|
for (const b of w.batches) if (isRecovery(b) && b.state === "pending" && !b.enable_manual_recovery) { b.state = "cancelled"; b.result = "Recovery is now optional. Run recovery when needed; registered work continues independently."; }
|
|
@@ -898,6 +898,9 @@ export class Engine {
|
|
|
898
898
|
// A stuck batch re-checks what it asked for like a queued one: once nothing still applies, it settles and leaves
|
|
899
899
|
// Needs you (a-batch-item-leaves-once-nothing-applies).
|
|
900
900
|
settleMoot(w, tasks, this.now());
|
|
901
|
+
// A person part leaves with its task: once GitHub no longer shows the condition, nothing of it waits on a person
|
|
902
|
+
// (a-person-part-leaves-with-its-task), and it stays gone if the condition comes back as new work.
|
|
903
|
+
settleGoneParts(w);
|
|
901
904
|
// A human-only outcome isn't a delivery that awaits GitHub: its still-open conditions are held as "person" at once.
|
|
902
905
|
// An in-progress answer holds its unchanged conditions while the agent's work runs (inProgressHolds), then they go
|
|
903
906
|
// out again like any unacknowledged condition, toward the same cap.
|
|
@@ -1002,20 +1005,25 @@ export class Engine {
|
|
|
1002
1005
|
agentWorkspace({ version: 1, workspaces: [w] }, agentId, "read", w.id);
|
|
1003
1006
|
requireTracking(w, agentId);
|
|
1004
1007
|
const b = w.batches.find(b => b.id === batchId);
|
|
1005
|
-
|
|
1008
|
+
// Still in progress, the agent may name its person part again or take back one set by mistake (waitingOn ""):
|
|
1009
|
+
// only the part and the words change, never when it settled (a-person-part-leaves-with-its-task).
|
|
1010
|
+
const restated = !!b?.inProgress && b.state === "completed" && outcome === "in_progress" && waitingOn !== undefined && !humanOnly;
|
|
1011
|
+
if (!b || !restated && !["sending", "sent", "blocked", "uncertain"].includes(b.state)) throw new Error("Batch is not awaiting acknowledgment.");
|
|
1006
1012
|
if ((b.recipientAgentId ?? w.mainAgentId) !== agentId) throw new Error(`Only the assigned agent can acknowledge this batch: expected agent ${b.recipientAgentId ?? w.mainAgentId}, received agent ${agentId}.`);
|
|
1007
1013
|
if (outcome === "completed" && b.tasks.some(t => t.kind === "obligation" && w.obligations.some(o => o.id === t.target && o.communication && o.status !== "waived" && (o.status !== "done" || !replyRecorded(o.communication))))) throw new Error("Record the sent reply on each communication task before completing this batch, or acknowledge blocked with the posting/access reason.");
|
|
1008
1014
|
if (humanOnly && (isRecovery(b) || completionCheck(b))) throw new Error("humanOnly is for repair batches. Acknowledge this one blocked with the reason.");
|
|
1009
1015
|
if (outcome === "in_progress" && (isRecovery(b) || completionCheck(b))) throw new Error("in_progress is for repair batches. Acknowledge this one completed or blocked.");
|
|
1016
|
+
if (restated) { b.result = result; if (waitingOn!.trim()) b.waitingOn = waitingOn!.trim(); else delete b.waitingOn; return w; }
|
|
1010
1017
|
// in_progress: the agent (or its own subagent) is already on it. Not a failure and not finished: the batch settles
|
|
1011
1018
|
// completed and its unchanged conditions wait for that work (inProgressHolds), never sent again meanwhile.
|
|
1012
1019
|
b.state = humanOnly || outcome === "in_progress" ? "completed" : outcome; b.result = result; b.acknowledgmentError = null; b.settledAt = new Date(this.now()).toISOString();
|
|
1013
1020
|
if (completionCheck(b) && outcome === "completed") b.doneCheckOutcome = "acknowledged";
|
|
1014
1021
|
if (humanOnly) b.humanOnly = true; else delete b.humanOnly;
|
|
1015
1022
|
// The person part is this answer's: a later answer without one says nothing waits on a person any more.
|
|
1016
|
-
// An in_progress answer that
|
|
1017
|
-
//
|
|
1018
|
-
|
|
1023
|
+
// An in_progress answer that leaves waitingOn out carries the last one over: "already on it" isn't "nothing waits on
|
|
1024
|
+
// a person". An explicit empty waitingOn takes a part set by mistake back while staying in progress; a completed or
|
|
1025
|
+
// blocked answer without one, or Hand back to agent, clears it too.
|
|
1026
|
+
const carried = outcome === "in_progress" && waitingOn === undefined ? b.tasks.map(t => personPart({ ...w, batches: w.batches.filter(x => x !== b) }, t.key)?.text).find(Boolean) : undefined;
|
|
1019
1027
|
const part = waitingOn?.trim() || carried;
|
|
1020
1028
|
if (part && !isRecovery(b) && !completionCheck(b)) b.waitingOn = part; else delete b.waitingOn;
|
|
1021
1029
|
if (outcome === "in_progress") b.inProgress = true; else delete b.inProgress;
|
package/server/mcp-source.ts
CHANGED
|
@@ -417,7 +417,7 @@ export const mcpSource: string = [
|
|
|
417
417
|
" [\"register_pr\", \"Register a PR this workspace produced, after submitting it, parents before children; again after restacking to update stack or parent. Mentions and external dependencies aren't yours. A closed PR is settled; disposition says why. agentMerges=true when you merge it yourself with no human review; false hands it back.\", \"follow.register-pr\", { repo: string, number: integer, stack: string, parentNumber: { type: [\"integer\", \"null\"], minimum: 1 }, disposition: string, agentMerges: boolean }, [\"repo\", \"number\", \"stack\"]],",
|
|
418
418
|
" [\"exclude_stack\", \"Move a stack registered by mistake out of this workspace: its PRs and the tasks in obligationIds go to an audit and can't be registered again. reason: the scope or ownership evidence.\", \"follow.exclude-stack\", { stack: string, reason: string, obligationIds: array }, [\"stack\", \"reason\"]],",
|
|
419
419
|
" [\"update_obligation\", \"Record a concrete follow-up task: a production check, migration, decision or stakeholder reply. Not approve/merge/deploy checklists. afterPrs: owner/repo#number. A task comes due by itself when its afterPrs reach dependencyStage, or on recheck (no PRs: 3 days after your last update); Follow-up names due tasks at your turn's end. status: waiting on a PR or another agent; blocked only on the developer; working records you (workingAgentId: your subagent). trigger sends the task to you as a message: now, merge or deploy (with delayDays) only for timing the developer asked for; at (at or inMinutes) for a time they named, or to check back on something Follow-up can't see. Never a sleep loop or your own timer (CI: wait_for_checks). communication: a Slack reply the developer authorized.\", \"follow.obligation\", { id: string, workingAgentId: string, title: string, status: { type: \"string\", enum: [\"pending\", \"waiting\", \"working\", \"blocked\", \"done\", \"waived\"] }, afterPrs: array, dependencyStage: { type: \"string\", enum: [\"merged\", \"deployed\"] }, evidence: string, ask: { ...string, description: \"With blocked: a decision you haven't asked yet (asked with ask_question: pass question).\" }, question: { type: \"string\", pattern: \"^Q\\\\d+$\", description: \"With blocked: the Q<n> you asked with ask_question (task set to this task).\" }, need: { type: \"string\", enum: [\"decision\", \"action\"], description: \"With ask: decision (they choose) or action (they do something and report back; the card has Done). Left out: read from the ask.\" }, enable_follow_up: boolean, communication, trigger, recheck: { type: \"string\", description: \"\\\"YYYY-MM-DD\\\": when to look again. Set it when you keep a due task open, with why in evidence.\" }, new: { type: \"boolean\", description: \"Add it even though a similar open task exists.\" } }, [\"title\", \"status\"]],",
|
|
420
|
-
" [\"acknowledge_batch\", \"Report a Follow-up batch's result by its batch ID before ending the turn. completed: every task verified. in_progress: you or your subagent are already on it; it isn't resent until that ends or GitHub changes. blocked: the reason; humanOnly=true when only a person can move it (a reviewer must re-review). waitingOn: the part
|
|
420
|
+
" [\"acknowledge_batch\", \"Report a Follow-up batch's result by its batch ID before ending the turn. completed: every task verified. in_progress: you or your subagent are already on it; it isn't resent until that ends or GitHub changes. blocked: the reason; humanOnly=true when only a person can move it (a reviewer must re-review). waitingOn: the part only a person (never an agent or a report) can move, while you do the rest; \\\"\\\" clears it.\", \"follow.acknowledge\", { batchId: string, outcome: { type: \"string\", enum: [\"completed\", \"blocked\", \"in_progress\"] }, result: { ...string, maxLength: 2000 }, humanOnly: { type: \"boolean\" }, waitingOn: { ...string, maxLength: 500 } }, [\"batchId\", \"outcome\", \"result\"]],",
|
|
421
421
|
" [\"ask_question\", \"Ask the developer a decision you can't make yourself: a short title, the question, lettered options with what each means for them, and the one you recommend. big: only when building ahead would send something off this machine, change something others rely on, or most remaining work builds on it. Link a PR (owner/repo#number) or task; a task waiting on it then goes blocked with update_obligation question=\\\"Q<n>\\\". Asking again returns the open one; supersedes=\\\"Q<n>\\\" replaces it. Every card ends with Something else; don't add an \\\"Other\\\" option. URLs and owner/repo#123 are clickable. The reply says what to do until the answer arrives.\", \"follow.ask-question\", { title: { ...string, maxLength: 120 }, question: { ...string, maxLength: 2000 }, options: { type: \"array\", maxItems: 26, items: { type: \"object\", properties: { letter: { type: \"string\", pattern: \"^[A-Z]$\" }, label: { ...string, maxLength: 200 }, consequence: { ...string, maxLength: 600 } }, required: [\"letter\", \"label\"], additionalProperties: false } }, recommend: string, big: string, background: string, links: { type: \"array\", maxItems: 10, items: { type: \"object\", properties: { url: string, path: string, card: string, label: string }, additionalProperties: false } }, pr: string, task: string, supersedes: { type: \"string\", pattern: \"^Q\\\\d+$\" } }, [\"title\", \"question\"]],",
|
|
422
422
|
" [\"record_answer\", \"Record the developer's answer to an open question when they answered in chat. choice: the option letter, their short answer when there were no options, or \\\"other\\\" with their words in words.\", \"follow.record-answer\", { id: string, choice: string, words: string }, [\"id\", \"choice\"]],",
|
|
423
423
|
" [\"note_question\", \"When the developer asks something to answer rather than do (an opinion, a how or why), call this first with their words: it goes on their Your questions. Once per message. Not for commands, status pings or a message with a ctx- id. The reply says how to hand in the answer.\", \"follow.note-question\", { question: { ...string, minLength: 1, maxLength: 2000 } }, [\"question\"]],",
|
package/server/mcp.mjs
CHANGED
|
@@ -33,7 +33,7 @@ const tools = [
|
|
|
33
33
|
["register_pr", "Register a PR this workspace produced, after submitting it, parents before children; again after restacking to update stack or parent. Mentions and external dependencies aren't yours. A closed PR is settled; disposition says why. agentMerges=true when you merge it yourself with no human review; false hands it back.", "follow.register-pr", { repo: string, number: integer, stack: string, parentNumber: { type: ["integer", "null"], minimum: 1 }, disposition: string, agentMerges: boolean }, ["repo", "number", "stack"]],
|
|
34
34
|
["exclude_stack", "Move a stack registered by mistake out of this workspace: its PRs and the tasks in obligationIds go to an audit and can't be registered again. reason: the scope or ownership evidence.", "follow.exclude-stack", { stack: string, reason: string, obligationIds: array }, ["stack", "reason"]],
|
|
35
35
|
["update_obligation", "Record a concrete follow-up task: a production check, migration, decision or stakeholder reply. Not approve/merge/deploy checklists. afterPrs: owner/repo#number. A task comes due by itself when its afterPrs reach dependencyStage, or on recheck (no PRs: 3 days after your last update); Follow-up names due tasks at your turn's end. status: waiting on a PR or another agent; blocked only on the developer; working records you (workingAgentId: your subagent). trigger sends the task to you as a message: now, merge or deploy (with delayDays) only for timing the developer asked for; at (at or inMinutes) for a time they named, or to check back on something Follow-up can't see. Never a sleep loop or your own timer (CI: wait_for_checks). communication: a Slack reply the developer authorized.", "follow.obligation", { id: string, workingAgentId: string, title: string, status: { type: "string", enum: ["pending", "waiting", "working", "blocked", "done", "waived"] }, afterPrs: array, dependencyStage: { type: "string", enum: ["merged", "deployed"] }, evidence: string, ask: { ...string, description: "With blocked: a decision you haven't asked yet (asked with ask_question: pass question)." }, question: { type: "string", pattern: "^Q\\d+$", description: "With blocked: the Q<n> you asked with ask_question (task set to this task)." }, need: { type: "string", enum: ["decision", "action"], description: "With ask: decision (they choose) or action (they do something and report back; the card has Done). Left out: read from the ask." }, enable_follow_up: boolean, communication, trigger, recheck: { type: "string", description: "\"YYYY-MM-DD\": when to look again. Set it when you keep a due task open, with why in evidence." }, new: { type: "boolean", description: "Add it even though a similar open task exists." } }, ["title", "status"]],
|
|
36
|
-
["acknowledge_batch", "Report a Follow-up batch's result by its batch ID before ending the turn. completed: every task verified. in_progress: you or your subagent are already on it; it isn't resent until that ends or GitHub changes. blocked: the reason; humanOnly=true when only a person can move it (a reviewer must re-review). waitingOn: the part
|
|
36
|
+
["acknowledge_batch", "Report a Follow-up batch's result by its batch ID before ending the turn. completed: every task verified. in_progress: you or your subagent are already on it; it isn't resent until that ends or GitHub changes. blocked: the reason; humanOnly=true when only a person can move it (a reviewer must re-review). waitingOn: the part only a person (never an agent or a report) can move, while you do the rest; \"\" clears it.", "follow.acknowledge", { batchId: string, outcome: { type: "string", enum: ["completed", "blocked", "in_progress"] }, result: { ...string, maxLength: 2000 }, humanOnly: { type: "boolean" }, waitingOn: { ...string, maxLength: 500 } }, ["batchId", "outcome", "result"]],
|
|
37
37
|
["ask_question", "Ask the developer a decision you can't make yourself: a short title, the question, lettered options with what each means for them, and the one you recommend. big: only when building ahead would send something off this machine, change something others rely on, or most remaining work builds on it. Link a PR (owner/repo#number) or task; a task waiting on it then goes blocked with update_obligation question=\"Q<n>\". Asking again returns the open one; supersedes=\"Q<n>\" replaces it. Every card ends with Something else; don't add an \"Other\" option. URLs and owner/repo#123 are clickable. The reply says what to do until the answer arrives.", "follow.ask-question", { title: { ...string, maxLength: 120 }, question: { ...string, maxLength: 2000 }, options: { type: "array", maxItems: 26, items: { type: "object", properties: { letter: { type: "string", pattern: "^[A-Z]$" }, label: { ...string, maxLength: 200 }, consequence: { ...string, maxLength: 600 } }, required: ["letter", "label"], additionalProperties: false } }, recommend: string, big: string, background: string, links: { type: "array", maxItems: 10, items: { type: "object", properties: { url: string, path: string, card: string, label: string }, additionalProperties: false } }, pr: string, task: string, supersedes: { type: "string", pattern: "^Q\\d+$" } }, ["title", "question"]],
|
|
38
38
|
["record_answer", "Record the developer's answer to an open question when they answered in chat. choice: the option letter, their short answer when there were no options, or \"other\" with their words in words.", "follow.record-answer", { id: string, choice: string, words: string }, ["id", "choice"]],
|
|
39
39
|
["note_question", "When the developer asks something to answer rather than do (an opinion, a how or why), call this first with their words: it goes on their Your questions. Once per message. Not for commands, status pings or a message with a ctx- id. The reply says how to hand in the answer.", "follow.note-question", { question: { ...string, minLength: 1, maxLength: 2000 } }, ["question"]],
|
package/server/tasks.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { join } from "node:path";
|
|
|
9
9
|
import { communicationReady } from "../shared/communication";
|
|
10
10
|
import { taskSchedule } from "../shared/task-trigger";
|
|
11
11
|
import { isWorkspaceRoot, type WorkspaceAgent } from "./workspace-agent";
|
|
12
|
-
import { personPart, taskUpdate } from "../shared/send-decision";
|
|
12
|
+
import { addedChecks, mergedParent, personPart, repairable, reviewAsks, taskUpdate } from "../shared/send-decision";
|
|
13
13
|
import { FIX_ONLY_LINE, type ReviewComments } from "../shared/pr-workflow";
|
|
14
14
|
|
|
15
15
|
function fingerprint(value: unknown): string { return createHash("sha256").update(JSON.stringify(value)).digest("hex"); }
|
|
@@ -24,12 +24,13 @@ export function tasksFor(w: Workspace, now = Date.now(), wording: TaskWording =
|
|
|
24
24
|
const tasks: Task[] = [];
|
|
25
25
|
const add = (kind: Task["kind"], target: string, title: string, value: unknown, parts?: string[]) => tasks.push({ key: `${kind}:${target}`, kind, target, title, fingerprint: fingerprint(value), ...(parts ? { parts } : {}) });
|
|
26
26
|
for (const pr of w.prs) {
|
|
27
|
-
|
|
28
|
-
if (!
|
|
27
|
+
// The same conditions taskGone (shared/send-decision.ts) reads: a task is yielded exactly while it isn't gone.
|
|
28
|
+
if (!repairable(pr)) continue;
|
|
29
|
+
const s = pr.snapshot!;
|
|
29
30
|
if (s.conflict) add("conflict", pr.key, `Resolve merge conflicts on ${pr.repo}#${pr.number}`, [s.head, s.base, "conflict"]);
|
|
30
31
|
// Review comments Off: no review-comment repair at all; the threads stay on the PR row for people.
|
|
31
32
|
const comments = wording.reviewComments?.(pr.repo) ?? "reply";
|
|
32
|
-
if (comments !== "off" && (s
|
|
33
|
+
if (comments !== "off" && reviewAsks(s)) {
|
|
33
34
|
// a-person-part-is-a-person-item: the agent's count leaves out the part it said waits on a person (the PR row keeps all).
|
|
34
35
|
const n = s.threads.length - (s.threads.length > 1 && personPart(w, `review:${pr.key}`) ? 1 : 0);
|
|
35
36
|
const reason = s.threads.length ? `${n} open thread${n === 1 ? "" : "s"}` : "changes requested";
|
|
@@ -42,11 +43,11 @@ export function tasksFor(w: Workspace, now = Date.now(), wording: TaskWording =
|
|
|
42
43
|
}
|
|
43
44
|
// Add to repairs (invariant 222, an-added-check-is-repaired): an optional check the developer added joins the PR's
|
|
44
45
|
// checks repair while it fails. Without one the repair's title and fingerprint are what they always were.
|
|
45
|
-
const added = (
|
|
46
|
+
const added = addedChecks(pr);
|
|
46
47
|
if (s.failedChecks.length && !added.length) add("checks", pr.key, `Fix required checks on ${pr.repo}#${pr.number}: ${s.failedChecks.join(", ")}`, [s.head, s.failedChecks.slice().sort()]);
|
|
47
48
|
else if (added.length) add("checks", pr.key, `Fix ${s.failedChecks.length ? "checks" : "optional checks"} on ${pr.repo}#${pr.number}: ${[...s.failedChecks, ...added].join(", ")}${s.failedChecks.length ? ` (${added.join(", ")} optional, added by the developer)` : " (added by the developer)"}`, [s.head, s.failedChecks.slice().sort(), added.slice().sort()]);
|
|
48
|
-
const parent = w
|
|
49
|
-
if (parent?.snapshot
|
|
49
|
+
const parent = mergedParent(w, pr);
|
|
50
|
+
if (parent?.snapshot) add("restack", pr.key, wording.github?.(pr.repo) || s.prWorkflow === "github" ? `Restack ${pr.repo}#${pr.number} onto ${s.trunk} after ${parent.repo}#${parent.number} merged: rebase, push with --force-with-lease, and retarget with gh pr edit --base ${s.trunk} if GitHub didn't` : `Reconcile stack parent after ${parent.repo}#${parent.number} merged`, [parent.key, parent.snapshot.head]);
|
|
50
51
|
}
|
|
51
52
|
for (const o of followUpObligations(w)) {
|
|
52
53
|
if (!o.enable_follow_up || !["pending", "waiting"].includes(o.status) || !communicationReady(o.communication)) continue;
|
package/shared/model.ts
CHANGED
|
@@ -184,6 +184,12 @@ export const batchSchema = z.object({
|
|
|
184
184
|
* tells the agent to leave that part (a-person-part-is-a-person-item).
|
|
185
185
|
*/
|
|
186
186
|
waitingOn: z.string().max(500).optional(),
|
|
187
|
+
/**
|
|
188
|
+
* Keys of this batch's tasks whose condition went away after the answer named `waitingOn` (the conflict resolved, the
|
|
189
|
+
* PR merged): the part no longer waits on a person for them, even if the condition comes back as new work
|
|
190
|
+
* (a-person-part-leaves-with-its-task, settleGoneParts in shared/send-decision.ts).
|
|
191
|
+
*/
|
|
192
|
+
partGone: z.array(z.string().max(500)).optional(),
|
|
187
193
|
/**
|
|
188
194
|
* The agent acknowledged it in_progress: it (or its own subagent) is already working on it. Settled completed, not a
|
|
189
195
|
* failure; its unchanged conditions are not sent again while that work runs (inProgressHolds, shared/send-decision.ts),
|
package/shared/send-decision.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { completionCheck, type Task, type Batch as StoredBatch } from "./model";
|
|
2
|
-
import type { ListBatch as Batch, ListWorkspace as Workspace } from "./list";
|
|
2
|
+
import type { ListBatch as Batch, ListPr, ListWorkspace as Workspace } from "./list";
|
|
3
|
+
import { finishedTask } from "./finished";
|
|
3
4
|
import { recoveryBatch } from "./follow-up";
|
|
4
5
|
|
|
5
6
|
/** How long a new batch waits before it goes out on its own, so tasks that land together go in one message. */
|
|
@@ -233,17 +234,35 @@ export const personHeld = (w: Pick<Workspace, "batches">, t: Pick<Task, "key" |
|
|
|
233
234
|
/**
|
|
234
235
|
* a-person-part-is-a-person-item: what the agent's latest answer for this task said only a person can move
|
|
235
236
|
* (Batch.waitingOn), else null. Keyed by the task, not its fingerprint, so a review that keeps changing keeps it; a
|
|
236
|
-
* later answer without one drops it.
|
|
237
|
+
* later answer without one drops it. a-person-part-leaves-with-its-task: once the task itself is gone (taskGone, or
|
|
238
|
+
* seen gone since the answer: Batch.partGone) nothing of it waits on a person, so a returning condition never brings
|
|
239
|
+
* the old part back. Without `prs` (a batch list alone) only the record decides.
|
|
237
240
|
*/
|
|
238
|
-
export function personPart(w: Pick<Workspace, "batches"
|
|
241
|
+
export function personPart(w: Pick<Workspace, "batches"> & Partial<Pick<Workspace, "prs" | "obligations">>, taskKey: string): { batchId: string; text: string } | null {
|
|
239
242
|
for (let i = w.batches.length - 1; i >= 0; i--) {
|
|
240
243
|
const b = w.batches[i]!;
|
|
241
|
-
|
|
242
|
-
|
|
244
|
+
const t = b.tasks.find(t => t.key === taskKey);
|
|
245
|
+
if (!b.sentAt || !b.settledAt || !["completed", "blocked"].includes(b.state) || b.unacknowledged || !t) continue;
|
|
246
|
+
if (!b.waitingOn || b.partGone?.includes(taskKey) || w.prs && taskGone({ prs: w.prs, obligations: w.obligations ?? [] }, t)) return null;
|
|
247
|
+
return { batchId: b.id, text: b.waitingOn };
|
|
243
248
|
}
|
|
244
249
|
return null;
|
|
245
250
|
}
|
|
246
251
|
|
|
252
|
+
/**
|
|
253
|
+
* Records, on each answer whose person part still stands, the tasks whose condition is gone now (taskGone), so the part
|
|
254
|
+
* stays gone if the condition comes back later as new work (a-person-part-leaves-with-its-task). Run with settleMoot.
|
|
255
|
+
*/
|
|
256
|
+
export function settleGoneParts(w: Pick<Workspace, "batches" | "prs" | "obligations">): void {
|
|
257
|
+
const keys = new Set(w.batches.flatMap(b => b.waitingOn ? b.tasks.map(t => t.key) : []));
|
|
258
|
+
for (const key of keys) {
|
|
259
|
+
const before = personPart({ batches: w.batches }, key);
|
|
260
|
+
if (!before || personPart(w, key)) continue;
|
|
261
|
+
const b = w.batches.find(b => b.id === before.batchId)!;
|
|
262
|
+
b.partGone = [...(b.partGone ?? []), key];
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
247
266
|
/** Blocked or unconfirmed: a repair batch whose outcome the developer is shown (Needs you's "The repairs didn't finish"). */
|
|
248
267
|
export const stuckRepair = (b: Pick<Batch, "state" | "tasks" | "movedOn">) =>
|
|
249
268
|
["blocked", "uncertain"].includes(b.state) && !b.movedOn && !recoveryBatch(b) && !(b.tasks.length > 0 && b.tasks.every(t => t.kind === "completion"));
|
|
@@ -260,6 +279,36 @@ function conditionKnown(w: Pick<Workspace, "prs">, t: Pick<Task, "kind" | "targe
|
|
|
260
279
|
return !pr || !!pr.snapshot?.complete && !pr.error;
|
|
261
280
|
}
|
|
262
281
|
|
|
282
|
+
/** A PR Follow-up repairs: GitHub answered in full and it is open and not a draft (server/tasks.ts tasksFor). */
|
|
283
|
+
export const repairable = (pr: Pick<ListPr, "snapshot" | "error">) => !!pr.snapshot?.complete && !pr.error && pr.snapshot.state === "OPEN" && !pr.snapshot.draft;
|
|
284
|
+
/** The review asks for something: open threads, or changes requested. */
|
|
285
|
+
export const reviewAsks = (s: Pick<NonNullable<ListPr["snapshot"]>, "threads" | "reviewDecision">) => !!s.threads?.length || s.reviewDecision === "CHANGES_REQUESTED";
|
|
286
|
+
/** Failing optional checks the developer added to repairs (Add to repairs, invariant 222). */
|
|
287
|
+
export const addedChecks = (pr: Pick<ListPr, "snapshot" | "repairChecks">) => (pr.snapshot?.otherFailedChecks ?? []).filter(c => pr.repairChecks?.includes(c));
|
|
288
|
+
/** The PR's stack parent once it merged (the restack task), else undefined. */
|
|
289
|
+
export const mergedParent = <P extends Pick<ListPr, "key" | "snapshot">>(w: { prs: readonly P[] }, pr: Pick<ListPr, "parent">): P | undefined => { const p = w.prs.find(p => p.key === pr.parent); return p?.snapshot?.state === "MERGED" ? p : undefined; };
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* a-person-part-leaves-with-its-task: the task's condition is known to be gone, by the same conditions tasksFor
|
|
293
|
+
* (server/tasks.ts) yields a task of that key with: the PR merged, closed, a draft or untracked, the conflict resolved,
|
|
294
|
+
* no open thread or requested change, the checks passing, the parent not merged, the task done, waived or removed.
|
|
295
|
+
* While GitHub's answer for its PR is unknown it isn't gone. A setting (Review comments Off) never makes it gone.
|
|
296
|
+
*/
|
|
297
|
+
export function taskGone(w: Pick<Workspace, "prs" | "obligations">, t: Pick<Task, "kind" | "target">): boolean {
|
|
298
|
+
if (t.kind === "inventory" || t.kind === "completion" || !conditionKnown(w, t)) return false;
|
|
299
|
+
if (t.kind === "obligation") { const o = w.obligations.find(o => o.id === t.target); return !o || finishedTask(o); }
|
|
300
|
+
const pr = w.prs.find(p => p.key === t.target);
|
|
301
|
+
if (!pr || !repairable(pr)) return true;
|
|
302
|
+
const s = pr.snapshot!;
|
|
303
|
+
switch (t.kind) {
|
|
304
|
+
case "conflict": return !s.conflict;
|
|
305
|
+
case "review": return !reviewAsks(s);
|
|
306
|
+
case "checks": return !s.failedChecks?.length && !addedChecks(pr).length;
|
|
307
|
+
case "restack": return !mergedParent(w, pr);
|
|
308
|
+
default: return false;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
263
312
|
/**
|
|
264
313
|
* Whether a stuck repair batch still asks for anything: some task's condition (key and fingerprint) is still open in
|
|
265
314
|
* `open` (server/tasks.ts tasksFor, the PRs as they are now), or its PR's state is unknown. Once nothing applies (every
|
|
@@ -18,7 +18,7 @@ import { HOME_GROUPS, homeCounts, prChip, trackedGroup, type HomeModel } from ".
|
|
|
18
18
|
import { needsEntries } from "./view-r";
|
|
19
19
|
import { freshPriorities, type Priority } from "./priorities";
|
|
20
20
|
import { agentCard, automaticHold, batchView, finishLine, holdSuperseded } from "./status";
|
|
21
|
-
import { conditionId, isCapped, mainWait, NO_PROGRESS_CAP, personHeld, personPart, sendDecision, stuckRepair } from "./send-decision";
|
|
21
|
+
import { conditionId, isCapped, mainWait, NO_PROGRESS_CAP, personHeld, personPart, sendDecision, stuckRepair, taskGone } from "./send-decision";
|
|
22
22
|
import { messageStrip, obligationDelivery, repairRows } from "./task-rows";
|
|
23
23
|
import { followUpObligations } from "./follow-up";
|
|
24
24
|
import { PRESENCE, claimsWorking, taskStatus, waitedAgent } from "./task-status";
|
|
@@ -195,6 +195,18 @@ export const INVARIANTS: Invariant[] = [
|
|
|
195
195
|
return null;
|
|
196
196
|
},
|
|
197
197
|
},
|
|
198
|
+
{
|
|
199
|
+
id: "a-person-part-leaves-with-its-task",
|
|
200
|
+
why: "2026-12-04 (2.7.0-beta.2): a main agent acknowledged two conflict repairs with waitingOn set. Hours after the conflicts were fixed and both PRs were mergeable, Needs you still showed \"Part of #N waits on a person\" for each: the part only checked that the PR was open. Once its task's condition is gone (whatever tasksFor no longer yields) the part leaves; while GitHub's answer is unknown it stays.",
|
|
201
|
+
check(w, now) {
|
|
202
|
+
for (const i of needsYou(w, now)) {
|
|
203
|
+
if (i.kind !== "person" || !i.part) continue;
|
|
204
|
+
const t = w.batches.flatMap(b => b.tasks).find(t => t.key === i.taskKey);
|
|
205
|
+
if (t && taskGone(w, t)) return `${i.taskKey}: GitHub no longer shows the task, but Needs you still says part of it waits on a person`;
|
|
206
|
+
}
|
|
207
|
+
return null;
|
|
208
|
+
},
|
|
209
|
+
},
|
|
198
210
|
{
|
|
199
211
|
id: "a-pr-summary-says-the-worst",
|
|
200
212
|
why: "2026-11-22: a 126-PR workspace with four PRs failing checks read \"#1001+125 ✓\" on Home (the chip took the first open PR's state) and \"Checks are running\" in the panel header (running outranked failing). A line or chip that sums up a workspace's PRs says the worst of its open PRs, and the chip counts failing PRs as the live line does.",
|