paseo-follow-up 1.4.0-beta.17 → 1.4.0-beta.18
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/OVERVIEW.md +4 -2
- package/README.md +13 -5
- package/client/panel.tsx +2 -1
- package/client/pr-controls.tsx +21 -9
- package/client/pr-sheet.tsx +3 -2
- package/client/stacks.tsx +3 -2
- package/index.server.ts +54 -5
- package/package.json +2 -1
- package/server/agent-actions.ts +7 -1
- package/server/agent-hook.mjs +21 -7
- package/server/daemon.ts +5 -0
- package/server/engine.ts +25 -5
- package/server/github.ts +66 -5
- package/server/hook-source.ts +1 -1
- package/server/mcp-source.ts +1 -1
- package/server/mcp.d.mts +3 -1
- package/server/mcp.mjs +42 -7
- package/server/native-tools.ts +3 -2
- package/server/pr-actions.ts +91 -15
- package/server/pr-workflow.ts +181 -0
- package/server/scopes.ts +20 -8
- package/server/tasks.ts +9 -3
- package/shared/activity.ts +3 -1
- package/shared/attention.ts +8 -4
- package/shared/contracts.ts +10 -1
- package/shared/model.ts +7 -0
- package/shared/pr-actions.ts +26 -4
- package/shared/pr-workflow.ts +99 -0
- package/skills/follow-through/SKILL.md +1 -1
package/OVERVIEW.md
CHANGED
|
@@ -13,14 +13,14 @@ Follow-up watches every pull request a Paseo workspace opens until the work is a
|
|
|
13
13
|
- Questions from the main agent, each with a permanent ref (Q1, Q2…), lettered options, the agent's recommendation and what it does while it waits. Pick an option, add a note and Send it to the agent, or Copy it instead. Answered questions stay listed under their ref, and the question mode setting (Stop, Work around, Keep building) tells agents what to do until you answer.
|
|
14
14
|
- A Spec link in the header to the page that sums up the workspace, usually the Claude artifact the main agent keeps up to date.
|
|
15
15
|
- An Activity card: repairs sent and finished with how long they took, merges, PR actions and questions.
|
|
16
|
-
- Each stack drawn top to base
|
|
16
|
+
- Each stack drawn top to base, merged PRs folded away, and a sheet per PR with checks, reviewers and Merge.
|
|
17
17
|
- Tasks for work that outlives a merge, manual or scheduled after a merge or deploy, with an optional delay.
|
|
18
18
|
- A composer pill and a sidebar count that appear only when something needs you; the pill steps through open questions so you can answer without leaving the chat. Home lists every workspace by who is up next, and a larger view opens a workspace in two columns.
|
|
19
19
|
- Compact rows for Follow-up's own tool calls in agent chats, a card for each repair batch, and a card when the agent declares Done.
|
|
20
20
|
|
|
21
21
|
## Setup
|
|
22
22
|
|
|
23
|
-
Requires Paseo 0.14+, Node 22+ and an authenticated `gh` on the daemon host. Merge uses saved Graphite CLI authentication. Follow-up follows every workspace that has an agent; Settings has per-project and per-workspace exceptions. The optional Send to Paseo browser companion adds Graphite's Merge when ready switch through its existing pairing; it is not needed for anything else.
|
|
23
|
+
Requires Paseo 0.14+, Node 22+ and an authenticated `gh` on the daemon host. Works with plain GitHub; Graphite is optional and picked per repository (Auto chooses Graphite only where the `gt` CLI is installed, signed in and the repository was set up with `gt init`). In Graphite repositories Merge uses saved Graphite CLI authentication; elsewhere it runs `gh pr merge`, and When ready is GitHub auto-merge. Follow-up follows every workspace that has an agent; Settings has per-project and per-workspace exceptions. The optional Send to Paseo browser companion adds Graphite's Merge when ready switch through its existing pairing; it is not needed for anything else.
|
|
24
24
|
|
|
25
25
|
## What it does on its own, and what it never does
|
|
26
26
|
|
|
@@ -36,6 +36,8 @@ This is a trusted, unsandboxed plugin. It reads workspace metadata, saved agent
|
|
|
36
36
|
|
|
37
37
|
Follow-up reads Paseo's agent, workspace and project lists into one in-memory directory shared by discovery, runtime checks, the Needs-you inbox, the Overseer and every client RPC. It reads the lists once at start, then patches the directory from lifecycle events: turn started or ended, permission requested or resolved, agent created, closed or archived, workspace created or archived. A change marks it dirty, and a dirty directory re-reads at most once a minute; a clean one re-reads every ten minutes. Before anything that would load an agent (a timeline or provider-subagent read), Follow-up re-reads that one agent, because the cached copy may predate Paseo unloading it. Provider subagents are asked about only when a send is due or waiting for acknowledgment, or completion is being checked. The Done label is sent only when it changes. In the app, the panel, the larger view and the pill draw from the client's shared workspace poll, which runs every 15 s plus a refresh shortly after Paseo reports an agent change. The inbox runs the same way and passes the tag of the list it holds, so an unchanged list comes back empty. Display preferences re-read once a minute. None of these poll while the app is hidden.
|
|
38
38
|
|
|
39
|
+
The PR workflow setting lives in `plugin-data/follow-through/pr-workflow.json` (owner-only): the default, per-repository overrides, merge methods and the review-fix instruction. Auto-detection reads only files: PATH for a `gt` executable, `~/.config/graphite/auth` for a sign-in token's presence (never sent anywhere by detection), and `<git dir>/.graphite_repo_config` in the checkout of the repository's Paseo project. It never runs `gt` and caches for ten minutes. Repositories that resolve to GitHub get no Graphite API calls; their readiness, merge method and auto-merge come from the same `gh api graphql` query that already reads each PR, so there is no extra polling. The first start with this setting seeds the review-fix instruction to `/fix-pr` when `~/.claude/commands/fix-pr.md` or `~/.claude/skills/fix-pr/SKILL.md` exists, once.
|
|
40
|
+
|
|
39
41
|
Reviewer lists live in `plugin-data/follow-through/reviewers.json` (owner-only), apart from `state.json`. Each list is per repository, plus a default for repositories without one, and each user keeps their own. Collaborator and team suggestions are read with `gh api` only when you open Add reviewer. They are cached for ten minutes, and never polled.
|
|
40
42
|
|
|
41
43
|
The Needs-you inbox (beta) keeps one flag per root agent in `plugin-data/follow-through/inbox.json`. When a turn starts it reads the newest user message from the agent's recent timeline to tell your messages from automation, and it reads, never writes, Defer's `plugin-data/defer/queue.json`, Smart Session's `plugin-data/smart-session/compactions.json`, Session Guard's `plugin-data/session-guard/state.json` and Paseo's schedule records. An unknown or unreadable format counts as your message, which clears a flag rather than adding one. Signing off also clears Paseo's own unread dot for that agent. The first-run import and the restart check read only Paseo's agent list: an agent's last activity is its unread time or your last message to it, never Paseo's `updatedAt` (which the daemon rewrites in bulk), and they don't fetch timelines, which would load every agent. Closed and archived agents are never imported. Turning the inbox off stops all of this.
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Screenshots use synthetic workspaces and PRs.
|
|
|
20
20
|
paseo plugin install paseo-follow-up
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Needs Node 22+ and an authenticated GitHub CLI (`gh`) on the daemon host.
|
|
23
|
+
Needs Node 22+ and an authenticated GitHub CLI (`gh`) on the daemon host. The installed plugin ID stays `follow-through`, so existing settings and tracked work carry over.
|
|
24
24
|
|
|
25
25
|
## Getting started
|
|
26
26
|
|
|
@@ -44,12 +44,20 @@ The panel shows this workspace only, top to bottom: a **Home** button, the main
|
|
|
44
44
|
|
|
45
45
|
- **Status.** How many PRs have merged, how many things need you, how many PRs need fixing, and a bar with one segment per PR in merge order. Below it, what the agent is doing right now.
|
|
46
46
|
- **Needs you.** One row per decision, each with its button: answer the agent's question, send repairs to the main agent, merge an approved PR, resume after you stopped the agent, or retry a batch that didn't finish.
|
|
47
|
-
- **Pull requests.** Each stack drawn top to base,
|
|
47
|
+
- **Pull requests.** Each stack drawn top to base, with merged PRs folded away.
|
|
48
48
|
- **Tasks.** Work that outlives a merge, such as a production check or a backfill. Tasks wait for you unless you schedule them for after a merge or deploy.
|
|
49
49
|
- **Activity.** What happened and how long it took: repairs sent and finished, merges, merge and reviewer actions, and every question under its ref.
|
|
50
50
|
|
|
51
51
|
The **Spec** chip in the header opens the page that sums up the workspace, usually the Claude artifact the main agent keeps up to date. The agent registers it with a tool call, Follow-up also picks up artifacts the workspace's sessions publish, and you can set, change or remove it under **Spec, agent and recovery**. Your link wins over the agent's, which wins over detection.
|
|
52
52
|
|
|
53
|
+
## Works with GitHub; Graphite optional
|
|
54
|
+
|
|
55
|
+
Follow-up works with plain GitHub out of the box: readiness comes from GitHub itself (its merge state, required checks, reviews, unresolved threads, branch protection and rulesets, and the merge queue if the repository has one), **Merge** runs `gh pr merge` with a merge method the repository allows, and **Auto-merge** is GitHub's own auto-merge. Stacks are chains of base branches: a PR whose base is another PR's branch sits on top of it, a stack merges bottom to top, and after a parent merges Follow-up retargets the child to trunk with `gh pr edit --base` if GitHub didn't already.
|
|
56
|
+
|
|
57
|
+
If you use [Graphite](https://graphite.dev), Follow-up picks it up per repository: **Auto** chooses Graphite where the `gt` CLI is on the daemon's PATH, signed in, and the repository was set up with `gt init`; everywhere else it's GitHub. Detection only looks at files (it never runs `gt`) and is cached for ten minutes. In Graphite repositories, Merge goes through Graphite with your saved CLI sign-in, and Merge when ready works through the Send to Paseo companion (below).
|
|
58
|
+
|
|
59
|
+
Auto is the default for every repository. Agents get instructions for the workflow their workspace uses, so a GitHub workspace never hears about Graphite, and they address review comments with Follow-up's built-in steps (read the unresolved threads with `gh`, fix, push, reply and resolve) unless an install already had a `/fix-pr` command or skill in `~/.claude`, which it keeps using.
|
|
60
|
+
|
|
53
61
|

|
|
54
62
|
|
|
55
63
|
### Questions
|
|
@@ -197,7 +205,7 @@ The choices live in `agents.json` in Follow-up's data folder. Anything missing o
|
|
|
197
205
|
Install the beta:
|
|
198
206
|
|
|
199
207
|
```sh
|
|
200
|
-
paseo plugin update follow-through --version 1.4.0-beta.
|
|
208
|
+
paseo plugin update follow-through --version 1.4.0-beta.18
|
|
201
209
|
# or, for a fresh install:
|
|
202
210
|
paseo plugin install npm:paseo-follow-up@beta
|
|
203
211
|
```
|
|
@@ -236,11 +244,11 @@ Tools that act on a list, and merge, return a dry run first and act only when ca
|
|
|
236
244
|
|
|
237
245
|
## Send to Paseo and Graphite
|
|
238
246
|
|
|
239
|
-
With [Send to Paseo](https://github.com/tomgrin10/send-to-paseo) on the same daemon, its composer picks the agent that registered the PR.
|
|
247
|
+
With [Send to Paseo](https://github.com/tomgrin10/send-to-paseo) on the same daemon, its composer picks the agent that registered the PR. In Graphite repositories, with Send to Paseo 2.2+, Follow-up can also toggle Graphite's **Merge when ready** through your existing pairing, while Graphite is open and signed in. Each change is confirmed in Chrome, which can remember the permission per repository. With the next Send to Paseo release, its popover on a PR page also shows which tracked workspaces own the PR, with Follow-up's one line for each (for example "Needs you · Merge ready"), and opens the workspace's main agent in the Paseo app or web app. See the [integration and security contract](https://github.com/tomgrin10/send-to-paseo/blob/main/docs/follow-up-integration.md).
|
|
240
248
|
|
|
241
249
|
## Data and access
|
|
242
250
|
|
|
243
|
-
Paseo plugins run trusted, unsandboxed code on the daemon host. Follow-up reads workspace metadata, agent history and GitHub PR status with your existing credentials, and keeps its state in `$PASEO_HOME/plugin-data/follow-through`. It registers scoped MCP tools and reversible provider hooks only for tracked sessions, plus the action tools for root agents (above). GitHub and Graphite writes happen only after an explicit click, or a root agent's confirmed plan, and a fresh eligibility check.
|
|
251
|
+
Paseo plugins run trusted, unsandboxed code on the daemon host. Follow-up reads workspace metadata, agent history and GitHub PR status with your existing credentials, and keeps its state in `$PASEO_HOME/plugin-data/follow-through`. It registers scoped MCP tools and reversible provider hooks only for tracked sessions, plus the action tools for root agents (above). GitHub (and, in Graphite repositories, Graphite) writes happen only after an explicit click, or a root agent's confirmed plan, and a fresh eligibility check.
|
|
244
252
|
|
|
245
253
|
## Development
|
|
246
254
|
|
package/client/panel.tsx
CHANGED
|
@@ -210,7 +210,8 @@ function WorkspaceCard({ workspace: w, theme, compact, open, toggle, openAgent,
|
|
|
210
210
|
</View>
|
|
211
211
|
</View>
|
|
212
212
|
</CardRow>
|
|
213
|
-
{
|
|
213
|
+
{/* Graphite's merge-when-ready needs the browser companion; GitHub repositories use auto-merge and never see this. */}
|
|
214
|
+
{active && browserReady === false && w.prs.some(p => !settledForDisplay(p) && p.snapshot && p.snapshot.prWorkflow !== "github") && <CardRow theme={theme}>
|
|
214
215
|
<View style={{ gap: 8 }}>
|
|
215
216
|
<View style={{ gap: 2 }}>
|
|
216
217
|
<Text style={t.label}>Merge when ready</Text>
|
package/client/pr-controls.tsx
CHANGED
|
@@ -4,22 +4,30 @@ import { useRpc } from "@getpaseo/plugin/client";
|
|
|
4
4
|
import { Icon, useToast } from "@getpaseo/plugin/client/ui";
|
|
5
5
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
6
|
import { confirmPrActionRpc, preparePrActionRpc, prControlStatusRpc, requestReviewersRpc } from "../shared/contracts";
|
|
7
|
-
import { mergeBlockers, prActionBlocks, type ActionPlan, type PrActionKind } from "../shared/pr-actions";
|
|
7
|
+
import { isGithubFlow, mergeBlockers, prActionBlocks, type ActionPlan, type PrActionKind } from "../shared/pr-actions";
|
|
8
|
+
import type { MergeMethod } from "../shared/pr-workflow";
|
|
8
9
|
import { mergeQueued, mergeReady } from "../shared/attention";
|
|
9
10
|
import type { Pr, Workspace } from "../shared/model";
|
|
10
11
|
import { Button, Switch, errorText, text, type Theme } from "./kit";
|
|
11
12
|
import { noReviewers, resolveReviewers, withoutAuthor, type ReviewerEntry } from "../shared/reviewers";
|
|
12
13
|
import { ReviewerPicker, reviewerSettingsKey, useReviewerSettings, willAsk } from "./reviewers";
|
|
13
14
|
|
|
15
|
+
const METHOD_SENTENCE: Record<MergeMethod, string> = { squash: "squash and merge it", merge: "merge it with a merge commit", rebase: "rebase and merge it" };
|
|
16
|
+
/** Blockers read as nouns after "clears:"; proper names (GitHub, Graphite) keep their capital. */
|
|
17
|
+
const lowerFirst = (b: string) => /^(GitHub|Graphite)\b/.test(b) ? b : b[0].toLowerCase() + b.slice(1);
|
|
18
|
+
|
|
14
19
|
/**
|
|
15
20
|
* Merge, merge-when-ready and reviewer requests for one PR. Every write needs a click; Merge always
|
|
16
|
-
* prepares a fresh plan and asks again before anything reaches Graphite.
|
|
21
|
+
* prepares a fresh plan and asks again before anything reaches Graphite or GitHub. In GitHub mode When ready is
|
|
22
|
+
* GitHub's auto-merge, read with the PR, so it needs no browser companion; it's hidden when the repository disallows it.
|
|
17
23
|
*/
|
|
18
|
-
export function PrControls({ pr, workspace, theme, compact, browserReady, intent }: { browserReady: boolean; pr: Pr; workspace: Workspace; theme: Theme; compact: boolean; intent?: "merge" | "reviewers" | null }) {
|
|
24
|
+
export function PrControls({ pr, workspace, theme, compact, browserReady: companionReady, intent }: { browserReady: boolean; pr: Pr; workspace: Workspace; theme: Theme; compact: boolean; intent?: "merge" | "reviewers" | null }) {
|
|
19
25
|
const read = useRpc(prControlStatusRpc); const prepare = useRpc(preparePrActionRpc); const confirm = useRpc(confirmPrActionRpc); const cache = useQueryClient();
|
|
20
26
|
const requestReviewers = useRpc(requestReviewersRpc);
|
|
21
27
|
const toast = useToast();
|
|
22
28
|
const c = theme.colors; const t = text(c);
|
|
29
|
+
const github = isGithubFlow(pr.snapshot);
|
|
30
|
+
const browserReady = github ? !!pr.snapshot?.repoMerge?.autoMerge : companionReady;
|
|
23
31
|
const [plan, setPlan] = useState<ActionPlan | null>(null); const [notice, setNotice] = useState<string | null>(null);
|
|
24
32
|
const statusKey = ["follow-through", "pr-controls", workspace.id, pr.key, pr.snapshot?.head];
|
|
25
33
|
const status = useQuery({ queryKey: statusKey, queryFn: () => read({ workspaceId: workspace.id, prKey: pr.key }), refetchInterval: 10_000, enabled: browserReady });
|
|
@@ -57,7 +65,10 @@ export function PrControls({ pr, workspace, theme, compact, browserReady, intent
|
|
|
57
65
|
const loaded = !!reviewerSettings.data;
|
|
58
66
|
useEffect(() => { if (intent === "reviewers" && loaded && missingReviewers && !pr.snapshot?.draft && !reviewers.length) setPicking(true); }, [intent, loaded]);
|
|
59
67
|
if (pr.snapshot?.state !== "OPEN") return null;
|
|
60
|
-
const waitingFor = mergeBlockers(pr).filter(b => !b.startsWith("Graphite "));
|
|
68
|
+
const waitingFor = mergeBlockers(pr).filter(b => !b.startsWith("Graphite ")).map(lowerFirst);
|
|
69
|
+
// GitHub refuses auto-merge on a PR it can already merge, so the switch shows only while Merge is waiting, or to turn it off.
|
|
70
|
+
const showSwitch = browserReady && (!github || !canMerge || !!enabled);
|
|
71
|
+
const autoMergeOff = github && !!pr.snapshot?.repoMerge && !pr.snapshot.repoMerge.autoMerge && !canMerge && !queued;
|
|
61
72
|
return <View style={{ gap: 10 }}>
|
|
62
73
|
{missingReviewers && <View style={{ flexDirection: "row", alignItems: "center", flexWrap: "wrap", gap: 8 }}>
|
|
63
74
|
<Icon name="UserX" size={14} color={c.statusWarning} />
|
|
@@ -71,15 +82,16 @@ export function PrControls({ pr, workspace, theme, compact, browserReady, intent
|
|
|
71
82
|
onCancel={() => setPicking(false)} onRequest={(picked, remember) => reviewRequest.mutate({ picked, remember })} />}
|
|
72
83
|
{!plan && <View style={{ flexDirection: "row", alignItems: "center", flexWrap: "wrap", gap: 12 }}>
|
|
73
84
|
{(canMerge || queued || recentlySubmitted || busy) ? <Button title={busy ? checking.isPending ? "Checking…" : "Submitting…" : queued ? "Queued to merge" : recentlySubmitted ? "Submitted" : `Merge #${pr.number}`} icon={queued ? "Clock" : "GitMerge"} theme={theme} compact={compact} kind={canMerge ? "primary" : "secondary"} loading={busy} disabled={disabled || !canMerge} onPress={() => begin("merge")} />
|
|
74
|
-
: <Text style={[t.meta, { flex: 1 }]}>{waitingFor.length ? `Merge opens when it clears: ${waitingFor.join(", ")
|
|
75
|
-
{
|
|
85
|
+
: <Text style={[t.meta, { flex: 1 }]}>{waitingFor.length ? `Merge opens when it clears: ${waitingFor.join(", ")}.` : github ? "Waiting for GitHub to confirm it can merge." : "Waiting for Graphite to report it ready to merge."}</Text>}
|
|
86
|
+
{showSwitch && <Switch theme={theme} compact={compact} label={`${github ? "Auto-merge" : "When ready"}${known ? "" : " · unknown"}`} accessibilityLabel={`${github ? "Auto-merge" : "Merge when ready"} for ${pr.repo} pull request ${pr.number}`} value={known ? !!enabled : null} disabled={disabled} onChange={() => begin(enabled ? "disable_mwr" : "enable_mwr")} />}
|
|
76
87
|
</View>}
|
|
88
|
+
{!plan && autoMergeOff && <Text style={t.meta}>Auto-merge is off for this repository. Turn on Allow auto-merge in its GitHub settings.</Text>}
|
|
77
89
|
{error && <Text accessibilityRole="alert" style={[t.meta, { color: c.statusDanger }]}>{error}</Text>}
|
|
78
90
|
{notice && <Text accessibilityLiveRegion="polite" style={t.meta}>{notice}</Text>}
|
|
79
91
|
{plan && (plan.kind === "merge" || browserReady) && <View accessibilityRole="summary" style={{ gap: 8 }}>
|
|
80
92
|
<Text accessibilityRole="header" style={[t.label, { fontSize: 14, lineHeight: 20 }]}>{plan.kind === "merge" ? plan.prs.length > 1 ? "Merge the PRs underneath too?" : "Merge this PR?" : `${plan.kind === "enable_mwr" ? "Enable" : "Disable"} for downstack too?`}</Text>
|
|
81
|
-
<Text style={t.meta}>{plan.kind === "merge" ? plan.prs.length > 1 ? `#${pr.number} depends on ${plan.prs.length - 1} unmerged PR${plan.prs.length === 2 ? "" : "s"}. Merge these ${plan.prs.length} PRs in order:` : "Graphite will merge using this repository’s settings and required protections." : `Change merge when ready for #${pr.number} only, or for all ${plan.prs.length} listed PRs.`}</Text>
|
|
82
|
-
{plan.prs.map((p, i) => <View key={p.key} style={{ flexDirection: "row", gap: 8 }}>
|
|
93
|
+
<Text style={t.meta}>{plan.kind === "merge" ? plan.prs.length > 1 ? `#${pr.number} depends on ${plan.prs.length - 1} unmerged PR${plan.prs.length === 2 ? "" : "s"}. ${plan.mergeQueue ? `This repository merges through a merge queue, so #${plan.prs[0].number} goes in first; merge the next one after it lands:` : `Merge these ${plan.prs.length} PRs in order:`}` : plan.via === "github" ? plan.mergeQueue ? "GitHub adds it to this repository’s merge queue, which merges it once its checks pass." : `GitHub will ${METHOD_SENTENCE[plan.method ?? "squash"]} once this repository’s required protections pass.` : "Graphite will merge using this repository’s settings and required protections." : `Change ${plan.via === "github" ? "auto-merge" : "merge when ready"} for #${pr.number} only, or for all ${plan.prs.length} listed PRs.`}</Text>
|
|
94
|
+
{(plan.via !== "github" || plan.prs.length > 1 || plan.prs.some(p => p.blockers.length > 0)) && plan.prs.map((p, i) => <View key={p.key} style={{ flexDirection: "row", gap: 8 }}>
|
|
83
95
|
<Text style={[t.meta, { width: 16, textAlign: "right", fontVariant: ["tabular-nums"] }]}>{i + 1}.</Text>
|
|
84
96
|
<View style={{ flex: 1, gap: 2 }}>
|
|
85
97
|
<Text style={[t.body, { fontSize: 12, lineHeight: 17 }]}>#{p.number} · {p.title}</Text>
|
|
@@ -88,7 +100,7 @@ export function PrControls({ pr, workspace, theme, compact, browserReady, intent
|
|
|
88
100
|
</View>)}
|
|
89
101
|
{plan.blockers.map(blocker => <Text key={blocker} style={[t.meta, { color: c.statusWarning }]}>{blocker}</Text>)}
|
|
90
102
|
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8, marginTop: 2 }}>
|
|
91
|
-
<Button title={plan.kind === "merge" ? plan.prs.length > 1 ? `Merge all ${plan.prs.length} PRs` : `Merge #${pr.number}` : `${plan.kind === "enable_mwr" ? "Enable" : "Disable"} for all ${plan.prs.length} PRs`} kind="primary" theme={theme} compact={compact} loading={submit.isPending} disabled={submit.isPending || scopeBlocked("downstack")} onPress={() => act("downstack")} />
|
|
103
|
+
<Button title={plan.kind === "merge" ? plan.mergeQueue ? `Add #${plan.prs[0].number} to merge queue` : plan.prs.length > 1 ? `Merge all ${plan.prs.length} PRs` : `Merge #${pr.number}` : `${plan.kind === "enable_mwr" ? "Enable" : "Disable"} for all ${plan.prs.length} PRs`} kind="primary" theme={theme} compact={compact} loading={submit.isPending} disabled={submit.isPending || scopeBlocked("downstack")} onPress={() => act("downstack")} />
|
|
92
104
|
{plan.kind !== "merge" && plan.prs.length > 1 && <Button title="Just this PR" theme={theme} compact={compact} disabled={submit.isPending || scopeBlocked("target")} onPress={() => act("target")} />}
|
|
93
105
|
<Button title="Cancel" kind="ghost" theme={theme} compact={compact} disabled={submit.isPending} onPress={() => { setPlan(null); checking.reset(); submit.reset(); }} />
|
|
94
106
|
</View>
|
package/client/pr-sheet.tsx
CHANGED
|
@@ -54,8 +54,9 @@ export function PrSheet({ workspace: w, prKey, intent, theme, compact, browserRe
|
|
|
54
54
|
<PrControls key={`${pr.key}:${intent ?? ""}`} pr={pr} workspace={w} theme={theme} compact={compact} browserReady={browserReady} intent={intent} />
|
|
55
55
|
</View>}
|
|
56
56
|
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8, paddingTop: 12, borderTopWidth: 1, borderTopColor: c.border }}>
|
|
57
|
-
<Button theme={theme} compact={compact} icon="ExternalLink" title="Open in Graphite" accessibilityLabel={`Open ${pr.repo} pull request ${pr.number} in Graphite`} onPress={() => open(graphitePrUrl(pr))} />
|
|
58
|
-
{s?.url && <Button theme={theme} compact={compact}
|
|
57
|
+
{s?.prWorkflow !== "github" && <Button theme={theme} compact={compact} icon="ExternalLink" title="Open in Graphite" accessibilityLabel={`Open ${pr.repo} pull request ${pr.number} in Graphite`} onPress={() => open(graphitePrUrl(pr))} />}
|
|
58
|
+
{s?.url && s.prWorkflow === "github" && <Button theme={theme} compact={compact} icon="ExternalLink" title="Open on GitHub" accessibilityLabel={`Open ${pr.repo} pull request ${pr.number} on GitHub`} onPress={() => open(s.url)} />}
|
|
59
|
+
{s?.url && s.prWorkflow !== "github" && <Button theme={theme} compact={compact} kind="ghost" icon="Github" title="GitHub" accessibilityLabel={`Open ${pr.repo} pull request ${pr.number} on GitHub`} onPress={() => open(s.url)} />}
|
|
59
60
|
</View>
|
|
60
61
|
</>}
|
|
61
62
|
</Modal.Content>
|
package/client/stacks.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import type { Pr, Workspace } from "../shared/model";
|
|
|
4
4
|
import { compactPrStatus, orderedStacks, settledForDisplay } from "../shared/presentation";
|
|
5
5
|
import { mergeQueued, prTone, stackOrder } from "../shared/attention";
|
|
6
6
|
import { noReviewers } from "../shared/reviewers";
|
|
7
|
+
import { isGithubFlow } from "../shared/pr-actions";
|
|
7
8
|
import { Card, FoldRow, text, type Theme } from "./kit";
|
|
8
9
|
import { Spinner } from "./motion";
|
|
9
10
|
import { mergedColor, tint, toneColor, type Colors } from "./theme";
|
|
@@ -38,7 +39,7 @@ export function PrRow({ pr, theme, first, last, showRepo, onOpen, compact, wide
|
|
|
38
39
|
const line = c.border;
|
|
39
40
|
const extras = [
|
|
40
41
|
s?.state === "OPEN" && noReviewers(pr) ? "No reviewers" : null,
|
|
41
|
-
s?.state === "OPEN" && s.mergeWhenReady === "on" && !mergeQueued(pr) ? "Merge when ready" : null,
|
|
42
|
+
s?.state === "OPEN" && s.mergeWhenReady === "on" && !mergeQueued(pr) ? isGithubFlow(s) ? "Auto-merge" : "Merge when ready" : null,
|
|
42
43
|
].filter(Boolean) as string[];
|
|
43
44
|
return <Pressable accessibilityRole="button" accessibilityLabel={`Pull request ${pr.number}: ${s?.title ?? pr.stack}. ${label}. Open details`} onPress={() => onOpen(pr.key)}
|
|
44
45
|
style={state => ({ flexDirection: "row", gap: 10, paddingHorizontal: 12, minHeight: compact ? 52 : 44, backgroundColor: state.pressed ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
@@ -112,7 +113,7 @@ export function StacksCard({ workspace: w, theme, compact, open, toggle, onOpen,
|
|
|
112
113
|
return <Card theme={theme} compact={compact} icon="GitPullRequest" title="Pull requests" count={openCount ? `${openCount} open` : undefined}>
|
|
113
114
|
{inFlight.map(a => <View key={a.id} style={{ flexDirection: "row", gap: 8, paddingHorizontal: 12, paddingVertical: 8, borderTopWidth: 1, borderTopColor: c.border }}>
|
|
114
115
|
<View style={{ paddingTop: 3 }}><Spinner color={c.accent} size={12} /></View>
|
|
115
|
-
<Text style={[t.meta, { flex: 1, color: c.foreground }]}>{a.result || "Submitting to Graphite…"}</Text>
|
|
116
|
+
<Text style={[t.meta, { flex: 1, color: c.foreground }]}>{a.result || (isGithubFlow(w.prs.find(p => p.key === a.prs[0])?.snapshot) ? "Sending to GitHub…" : "Submitting to Graphite…")}</Text>
|
|
116
117
|
</View>)}
|
|
117
118
|
{!w.prs.length && <View style={{ paddingHorizontal: 12, paddingVertical: 10, borderTopWidth: 1, borderTopColor: c.border, gap: 4 }}>
|
|
118
119
|
<Text style={t.body}>No PRs yet</Text>
|
package/index.server.ts
CHANGED
|
@@ -43,7 +43,10 @@ import { copyFile, readFile, rename, stat } from "node:fs/promises";
|
|
|
43
43
|
import { HistoryCache } from "./server/history-cache";
|
|
44
44
|
import { Governor } from "./server/governor";
|
|
45
45
|
import { ListCache } from "./server/list-cache";
|
|
46
|
-
import { scopeWriter } from "./server/scopes";
|
|
46
|
+
import { scopeWriter, workflowSummary } from "./server/scopes";
|
|
47
|
+
import { PrWorkflowStore } from "./server/pr-workflow";
|
|
48
|
+
import { commandName } from "./shared/pr-workflow";
|
|
49
|
+
import { projectRepo } from "./server/daemon";
|
|
47
50
|
import { batchArchive, pruneUnsent } from "./server/batch-archive";
|
|
48
51
|
import { NO_USAGE } from "./shared/usage";
|
|
49
52
|
import { activeWindowMs, conversationGone, DEFAULT_ACTIVE_WINDOW_DAYS } from "./server/agent-load";
|
|
@@ -99,7 +102,12 @@ export default function contribute(server: PluginServerContext) {
|
|
|
99
102
|
};
|
|
100
103
|
const store = new Store(directory, 1_000);
|
|
101
104
|
const onboarding = new OnboardingStore(directory);
|
|
102
|
-
|
|
105
|
+
// PR workflow (Graphite or plain GitHub) per repository; scopes.json carries each agent's so its instructions match.
|
|
106
|
+
const prWorkflow = new PrWorkflowStore(directory);
|
|
107
|
+
let workspaceRepos: Map<string, string> = new Map();
|
|
108
|
+
const workspaceRepo = (w: Workspace): string | null => (w.prs.find(p => p.snapshot?.state === "OPEN") ?? w.prs.at(-1))?.repo ?? workspaceRepos.get(w.id) ?? null;
|
|
109
|
+
const knownRepos = (state: { workspaces: Workspace[] }) => new Set([...state.workspaces.filter(w => w.enable_tracking && !w.archived).flatMap(w => w.prs.map(p => repoKey(p.repo))), ...[...workspaceRepos.values()].map(repoKey)]);
|
|
110
|
+
store.onChanged = scopeWriter(directory, { agent: w => prWorkflow.agentWorkflow(workspaceRepo(w)), summary: state => workflowSummary([...knownRepos(state)].map(r => prWorkflow.cachedWorkflow(r))) });
|
|
103
111
|
const agentHooks = new AgentHooks(directory, clientEntry());
|
|
104
112
|
const historyCache = HistoryCache.at(directory);
|
|
105
113
|
const gateway = new PaseoGateway(undefined, undefined, undefined, historyCache);
|
|
@@ -108,11 +116,21 @@ export default function contribute(server: PluginServerContext) {
|
|
|
108
116
|
gateway.recoveryRole = () => agentSettings.role("recovery");
|
|
109
117
|
const graphite = new Graphite();
|
|
110
118
|
const github = new Github(undefined, graphite, new Deployments());
|
|
119
|
+
github.workflow = repo => prWorkflow.workflow(repo);
|
|
120
|
+
workspaceRepos = gateway.workspaceRepos;
|
|
121
|
+
prWorkflow.paths = async () => {
|
|
122
|
+
const paths = new Map<string, string>();
|
|
123
|
+
for (const p of await gateway.projects(await store.snapshot())) { const repo = projectRepo(p.key); if (repo && p.path && !paths.has(repoKey(repo))) paths.set(repoKey(repo), p.path); }
|
|
124
|
+
return paths;
|
|
125
|
+
};
|
|
126
|
+
prWorkflow.onChanged = () => { void store.snapshot().then(state => store.onChanged(state)).catch(() => undefined); };
|
|
111
127
|
const browser = new BrowserBridge();
|
|
112
128
|
const reviewerStore = new ReviewerConfigStore(directory);
|
|
113
129
|
const reviewerSuggestions = new ReviewerSuggestions();
|
|
114
130
|
const actions = new PrActions(store, github, graphite, browser);
|
|
131
|
+
actions.savedMethod = repo => prWorkflow.current().repos[repoKey(repo)]?.mergeMethod ?? null;
|
|
115
132
|
const engine = new Engine(store, github, gateway);
|
|
133
|
+
engine.wording = { reviewFix: repo => commandName(prWorkflow.reviewFix(repo)) };
|
|
116
134
|
const governor = new Governor();
|
|
117
135
|
const listCache = new ListCache();
|
|
118
136
|
engine.paused = () => !governor.allowsBackground();
|
|
@@ -248,6 +266,9 @@ export default function contribute(server: PluginServerContext) {
|
|
|
248
266
|
await backupActiveScope();
|
|
249
267
|
// Reviewers: the one-time seed from earlier requests, before history is pruned. An unreadable reviewers.json only affects Add reviewers.
|
|
250
268
|
await reviewerStore.migrate(await store.snapshot()).catch(() => undefined);
|
|
269
|
+
// PR workflow: the one-time /fix-pr seed, then resolve every known repository (filesystem checks only, never gt).
|
|
270
|
+
await prWorkflow.migrate().catch(() => undefined);
|
|
271
|
+
await prWorkflow.warm(knownRepos(await store.snapshot())).catch(() => undefined);
|
|
251
272
|
await pruneHistory();
|
|
252
273
|
await store.onChanged(await store.snapshot()).catch(() => undefined);
|
|
253
274
|
hooksStarted = true;
|
|
@@ -275,7 +296,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
275
296
|
const flags = { recovery, brief: !!brief && !recovery, root: root && !recovery, overseer: overseer && !recovery };
|
|
276
297
|
const env = { ...request.env, FOLLOW_THROUGH_TOOLS: "native", FOLLOW_THROUGH_PROVIDER: request.provider, ...(flags.root ? { FOLLOW_THROUGH_ROOT: "1" } : {}), ...(flags.overseer ? { FOLLOW_THROUGH_OVERSEER: "1" } : {}) };
|
|
277
298
|
if (/^[\w-]+$/.test(request.agentId)) await writeFile(join(directory, "hook-state", `native-${request.agentId}.json`), JSON.stringify({ instance: toolsInstance }), { mode: 0o600 }).catch(() => undefined);
|
|
278
|
-
return { ...request, env, tools: [...request.tools, ...nativeTools(flags, live, invoke)] };
|
|
299
|
+
return { ...request, env, tools: [...request.tools, ...nativeTools(flags, live, invoke, workflowSummary([...knownRepos(await store.snapshot())].map(r => prWorkflow.cachedWorkflow(r))))] };
|
|
279
300
|
}
|
|
280
301
|
return withSessionMcp({ ...request, env: { ...request.env, FOLLOW_THROUGH_TOOLS: "stdio", FOLLOW_THROUGH_PROVIDER: request.provider } }, directory, clientEntry(), paseoHome, recovery, process.env, brief, root, overseer, providers) as R;
|
|
281
302
|
};
|
|
@@ -384,7 +405,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
384
405
|
await agentHooks.confirm(w.id, agentId, summary);
|
|
385
406
|
return { workspaceId: w.id, synced: true as const };
|
|
386
407
|
});
|
|
387
|
-
handle(rpc.agentStatusRpc, async ({ agentId }, { paseo }) => { await requireReady(); const workspaceId = await callerWorkspaceId(agentId, paseo);
|
|
408
|
+
handle(rpc.agentStatusRpc, async ({ agentId }, { paseo }) => { await requireReady(); const workspaceId = await callerWorkspaceId(agentId, paseo); const w = agentWorkspace(await store.snapshot(), agentId, "read", workspaceId, "pr"); return { ...w, prWorkflow: prWorkflow.agentWorkflow(workspaceRepo(w)) }; });
|
|
388
409
|
handle(rpc.activateRpc, async ({ workspaceId }) => { await requireReady(); return engine.activate(workspaceId); });
|
|
389
410
|
handle(rpc.sendRpc, async ({ workspaceId, batchId }) => { await requireReady(); return engine.sendPending(workspaceId, batchId); });
|
|
390
411
|
handle(rpc.recoverRpc, async ({ workspaceId }) => { await requireReady(); return engine.startRecovery(workspaceId); });
|
|
@@ -565,6 +586,34 @@ export default function contribute(server: PluginServerContext) {
|
|
|
565
586
|
for (const w of (await store.snapshot()).workspaces) for (const p of w.prs) seen.add(repoKey(p.repo));
|
|
566
587
|
return { config, repos: [...seen].sort() };
|
|
567
588
|
};
|
|
589
|
+
const prWorkflowRepos = async () => {
|
|
590
|
+
const repos = new Set((await reviewerSettings()).repos);
|
|
591
|
+
for (const p of await gateway.projects(await store.snapshot()).catch(() => [])) { const repo = projectRepo(p.key); if (repo) repos.add(repoKey(repo)); }
|
|
592
|
+
for (const repo of Object.keys(prWorkflow.current().repos)) repos.add(repo);
|
|
593
|
+
return repos;
|
|
594
|
+
};
|
|
595
|
+
const prWorkflowView = async (fresh = false) => prWorkflow.view(await prWorkflowRepos(), fresh);
|
|
596
|
+
handle(rpc.prWorkflowRpc, async ({ refresh }) => {
|
|
597
|
+
await requireReady();
|
|
598
|
+
const view = await prWorkflowView(!!refresh);
|
|
599
|
+
if (refresh) prWorkflow.onChanged();
|
|
600
|
+
return view;
|
|
601
|
+
});
|
|
602
|
+
handle(rpc.setPrWorkflowRpc, async ({ repo, setting, default: fallback, mergeMethod, reviewFix }) => {
|
|
603
|
+
await requireReady();
|
|
604
|
+
if ((setting !== undefined || mergeMethod !== undefined || (reviewFix !== undefined && repo)) && !repo) throw new Error("Name the repository (owner/name) to change.");
|
|
605
|
+
await prWorkflow.mutate(config => {
|
|
606
|
+
if (fallback !== undefined) config.default = fallback;
|
|
607
|
+
if (!repo) { if (reviewFix) config.reviewFix = reviewFix; return; }
|
|
608
|
+
const own = config.repos[repoKey(repo)] ??= {};
|
|
609
|
+
if (setting !== undefined) { if (setting === null) delete own.workflow; else own.workflow = setting; }
|
|
610
|
+
if (mergeMethod !== undefined) { if (mergeMethod === null) delete own.mergeMethod; else own.mergeMethod = mergeMethod; }
|
|
611
|
+
if (reviewFix !== undefined) { if (reviewFix === null) delete own.reviewFix; else own.reviewFix = reviewFix; }
|
|
612
|
+
});
|
|
613
|
+
// A changed workflow changes readiness and merge: check the PRs again now rather than on the next poll.
|
|
614
|
+
void engine.tick();
|
|
615
|
+
return prWorkflowView();
|
|
616
|
+
});
|
|
568
617
|
handle(rpc.reviewerSettingsRpc, async () => { await requireReady(); return reviewerSettings(); });
|
|
569
618
|
handle(rpc.saveReviewersRpc, async ({ repo, reviewers }) => { await requireReady(); await reviewerStore.save(repo, reviewers); return reviewerSettings(); });
|
|
570
619
|
handle(rpc.reviewerSuggestionsRpc, async ({ repo }) => { await requireReady(); return reviewerSuggestions.suggest(repo); });
|
|
@@ -701,7 +750,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
701
750
|
if (!stopped) aboutTimer = setTimeout(() => void aboutLoop(), 10 * 60_000);
|
|
702
751
|
};
|
|
703
752
|
aboutTimer = setTimeout(() => void aboutLoop(), 60_000);
|
|
704
|
-
const agentActions = new AgentActions({ store, prActions: actions, engine, inbox, priorities: priorityStore, about, agentSettings });
|
|
753
|
+
const agentActions = new AgentActions({ store, prActions: actions, engine, inbox, priorities: priorityStore, about, agentSettings, prWorkflows: () => prWorkflowView() });
|
|
705
754
|
handle(rpc.prioritiesRpc, async () => ({ items: await priorityStore.read() }));
|
|
706
755
|
// Provider limits are non-essential: at critical memory only the VM meter is served.
|
|
707
756
|
handle(rpc.usageRpc, async () => ({ ...(governor.allowsExtras() ? await usage.read() : NO_USAGE), resources: governor.current() }));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paseo-follow-up",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.4.0-beta.
|
|
4
|
+
"version": "1.4.0-beta.18",
|
|
5
5
|
"description": "Follow every workspace PR stack in Paseo, answer agent questions, batch repairs for the main agent, and see what needs you.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"test:trust": "node scripts/check-trust-bypass.mjs",
|
|
29
29
|
"preview": "node scripts/check-install.mjs --keep",
|
|
30
30
|
"test:install": "node scripts/check-install.mjs",
|
|
31
|
+
"test:github-mode": "node scripts/check-github-mode.mjs",
|
|
31
32
|
"test:native": "node scripts/check-native-tools.mjs --agents 10",
|
|
32
33
|
"prepare": "node scripts/build.mjs",
|
|
33
34
|
"test:scale": "node scripts/scale-check.mjs --workspaces 120 --awake 5 --churn 35 --idle 60 --rss-budget 240 --cpu-budget 3 --request-budget 2"
|
package/server/agent-actions.ts
CHANGED
|
@@ -74,6 +74,8 @@ export type AgentActionDeps = {
|
|
|
74
74
|
about?: { view(workspaceId: string, opts: { open?: boolean; wait?: boolean }): Promise<AboutView> };
|
|
75
75
|
/** Settings → Agents, read-only: which agent each special role uses. No write tool. */
|
|
76
76
|
agentSettings?: { all(): Promise<Record<string, RoleConfig>> };
|
|
77
|
+
/** Each known repository's PR workflow (Settings → Following → Shipping PRs). */
|
|
78
|
+
prWorkflows?: () => Promise<{ default: string; repos: { repo: string; effective: string; setting: string; reason: string; reviewFix: unknown }[]; reviewFix: unknown }>;
|
|
77
79
|
now?: () => number;
|
|
78
80
|
};
|
|
79
81
|
|
|
@@ -115,6 +117,8 @@ export function prRow(w: Workspace, p: Pr) {
|
|
|
115
117
|
// Read-only: who Add reviewers would ask here and where that list comes from (Settings → Reviewers).
|
|
116
118
|
configuredReviewers: (({ reviewers, source }) => ({ source, reviewers: reviewers.map(r => ({ login: r.login, name: reviewerLabel(r) })) }))(resolveReviewers(reviewerConfig(), p.repo)),
|
|
117
119
|
needsReviewers: noReviewers(p) && !s!.draft, mergeable: blockers.length === 0, mergeBlockers: blockers,
|
|
120
|
+
// How this PR ships: "github" (gh pr merge, GitHub auto-merge) or "graphite". Older snapshots were Graphite's.
|
|
121
|
+
prWorkflow: s?.prWorkflow ?? "graphite",
|
|
118
122
|
};
|
|
119
123
|
}
|
|
120
124
|
|
|
@@ -139,7 +143,9 @@ export class AgentActions {
|
|
|
139
143
|
case "agent_settings": {
|
|
140
144
|
if (!this.d.agentSettings) throw new Error("agent_settings isn't available in this Follow-up.");
|
|
141
145
|
const roles = await this.d.agentSettings.all();
|
|
142
|
-
|
|
146
|
+
const workflows = await this.d.prWorkflows?.().catch(() => null);
|
|
147
|
+
return { roles: Object.values(roles).map(r => ({ ...r, summary: roleSummary(r), does: ROLE_INFO[r.role].does })), change: "Tom changes these in Follow-up settings → Agents.",
|
|
148
|
+
...(workflows ? { prWorkflow: { default: workflows.default, reviewFix: workflows.reviewFix, repos: workflows.repos.map(r => ({ repo: r.repo, workflow: r.effective, setting: r.setting, why: r.reason, reviewFix: r.reviewFix ?? workflows.reviewFix })), change: "Tom changes these in Follow-up settings → Following → Shipping PRs." } } : {}) };
|
|
143
149
|
}
|
|
144
150
|
case "add_reviewers": return this.planReviewers(caller, args);
|
|
145
151
|
case "merge": return this.planPr(caller, tool, "merge", args);
|
package/server/agent-hook.mjs
CHANGED
|
@@ -77,6 +77,20 @@ export function overseerDigest(file, seen, now = Date.now(), { needsMax = 20, ch
|
|
|
77
77
|
for (const l of lines) { if (text.length + l.length + 1 > chars) { text += "- …truncated: use workstreams()\n"; break; } text += l + "\n"; }
|
|
78
78
|
return { text: text.trimEnd(), seen: { at: now, rows: Object.fromEntries(all.map(r => [r.id, r.hash])) } };
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* How batches are worked, for this workspace's PR workflow (from scopes.json). Graphite with /fix-pr, and agents of an
|
|
82
|
+
* older worker that wrote no workflow, keep the original text; plain GitHub never mentions Graphite, gt or /fix-pr.
|
|
83
|
+
*/
|
|
84
|
+
export function batchParagraph(workflow) {
|
|
85
|
+
const mode = workflow?.mode ?? "graphite";
|
|
86
|
+
const fix = workflow === undefined || workflow === null ? "/fix-pr" : workflow.reviewFix ?? null;
|
|
87
|
+
const steps = "Follow-through batches contain a batch ID and task list. Read workspace_status and refresh live conditions before acting; skip resolved tasks. Process dependent PRs bottom to top, one PR fully before the next.";
|
|
88
|
+
const review = fix ? `Use the repository's ${fix} workflow, validate feedback, verify changes,` : "For review comments, read the PR's unresolved threads with gh, validate the feedback, fix it and verify the change,";
|
|
89
|
+
const submit = mode === "graphite" ? "submit through Graphite with --publish" : "push the branch (gh pr create for a new PR, gh pr ready when it leaves draft)";
|
|
90
|
+
const reply = fix ? "reply/resolve addressed threads" : "reply to each addressed thread and resolve it";
|
|
91
|
+
const restack = mode === "graphite" ? "Follow the repository's safe reparent procedure for merged parents" : "Keep stacked PRs as a chain of base branches: restack with git rebase --update-refs and push with --force-with-lease, and when a parent merges retarget its child with gh pr edit --base if GitHub didn't already";
|
|
92
|
+
return `${steps} ${review} ${submit}, and ${reply}. ${restack} and preserve uncommitted work.`;
|
|
93
|
+
}
|
|
80
94
|
const quote = value => "'" + value.replaceAll("'", "'\\''") + "'";
|
|
81
95
|
async function json(path) { return JSON.parse(await readFile(path, "utf8")); }
|
|
82
96
|
async function save(path, value) {
|
|
@@ -85,10 +99,10 @@ async function save(path, value) {
|
|
|
85
99
|
await writeFile(temporary, JSON.stringify(value), { mode: 0o600 });
|
|
86
100
|
await rename(temporary, path);
|
|
87
101
|
}
|
|
88
|
-
function instructions(lease, contributor = false) {
|
|
89
|
-
return named(paragraphs(lease, contributor).filter(p => !(native && /^Prefer (?:the )?native/i.test(p))).join("\n\n"));
|
|
102
|
+
function instructions(lease, contributor = false, workflow) {
|
|
103
|
+
return named(paragraphs(lease, contributor, workflow).filter(p => !(native && /^Prefer (?:the )?native/i.test(p))).join("\n\n"));
|
|
90
104
|
}
|
|
91
|
-
function paragraphs(lease, contributor) {
|
|
105
|
+
function paragraphs(lease, contributor, workflow) {
|
|
92
106
|
if (contributor) return [
|
|
93
107
|
"Maintain PR tracking for this session in its tracked workspace. Read workspace_status now and after compaction. Register every PR you submit, including from secondary git worktrees, with register_pr; register parents before children. References and external dependencies are not owned PRs. Call sync_workspace before finishing. The designated main agent retains goal, task, scope and completion authority.",
|
|
94
108
|
quietInstruction,
|
|
@@ -103,7 +117,7 @@ function paragraphs(lease, contributor) {
|
|
|
103
117
|
"Keep actual follow-through tasks current with update_obligation: production behavior checks, migrations and decisions, with concise titles, PR dependencies and evidence. Do not add merge/approval/deploy checklist tasks. Deployment-dependent work waits for verified serving revisions and existing production permissions.",
|
|
104
118
|
"Stakeholder replies are follow-through too. When asked to update a requester, capture the original Slack threadUrl, recipient and explicit developer authorization in the task's communication field; referenced messages alone do not authorize posting. Use a concise progress task now and, when needed, a verify-and-reply task with purpose=verified after the relevant deployed PRs. Read existing thread replies and refresh evidence before posting; distinguish fixed, deployed and verified. Record the actual sent replyUrl and result before marking done. If posting is unavailable or its outcome is uncertain, keep the task blocked and check the thread before any retry; never claim a draft was sent. Auto authorizes delivery to you, not external messages. Communication-only requests do not authorize repairs, benchmarks, migrations or other production writes.",
|
|
105
119
|
"Tasks are manual unless explicitly scheduled with trigger={event:\"now\"|\"merge\"|\"deploy\",delayDays:0}. Only set a trigger from the developer\u2019s requested timing; never infer timing from a title or enable_follow_up alone. Merge/deploy triggers require owned afterPrs; delayDays=14 waits fourteen days after the last dependency event. Now requires no PR dependencies or delay. Deployment timing starts at the first verified fully serving observation and remains conservative when history is unknown. Preserve existing trigger fields on updates; trigger=null makes a task manual. Auto controls delivery, not timing or production permissions.",
|
|
106
|
-
|
|
120
|
+
batchParagraph(workflow) + " For post-deploy tasks, verify the currently serving revision contains every dependency and record behavioral results separately. Acknowledge the header's batch ID with acknowledge_batch before finishing: completed with the result, or blocked with the reason. Verify the entire goal and post-merge work before declare_done; acknowledge a completion batch first. Merging and archiving remain the developer's actions.",
|
|
107
121
|
"Before ending this turn, reconcile the sidebar with what you actually did and call sync_workspace with a short summary, including when no changes are needed. Acknowledge any assigned batch. When the entire goal is fulfilled, use declare_done; otherwise preserve remaining work. Do not launch recovery, start queued repairs, merge, toggle merge-when-ready, or archive as part of this bookkeeping. Auto still governs separate follow-up sends. Subagents report to the main agent instead of claiming workspace ownership.",
|
|
108
122
|
`Prefer the native follow-through MCP tools. For a full historical record, use workspace_status with detail=full. CLI compatibility fallback: FOLLOW_THROUGH_CLIENT_ENTRY=${quote(lease.clientEntry)} node ${quote(join(directory, "mcp.mjs"))} call <tool> '<json>' --compact. Omit --compact only when an existing script needs the full response. Never ask the developer to maintain the sidebar or run this bridge.`,
|
|
109
123
|
];
|
|
@@ -157,8 +171,8 @@ async function main() {
|
|
|
157
171
|
}
|
|
158
172
|
// scopes.json is a few KB; this hook runs on every tool call. Older workers don't write it: read state.json.
|
|
159
173
|
const scopes = await json(join(directory, "scopes.json")).catch(() => null);
|
|
160
|
-
let workspace = null; let contributor = false;
|
|
161
|
-
if (scopes?.agents) { const entry = scopes.agents[agentId]; if (entry && entry.role !== "recovery") { workspace = { id: entry.workspaceId }; contributor = entry.role === "contributor"; } }
|
|
174
|
+
let workspace = null; let contributor = false; let workflow;
|
|
175
|
+
if (scopes?.agents) { const entry = scopes.agents[agentId]; if (entry && entry.role !== "recovery") { workspace = { id: entry.workspaceId }; contributor = entry.role === "contributor"; workflow = entry.workflow; } }
|
|
162
176
|
else {
|
|
163
177
|
const state = await json(join(directory, "state.json")).catch(() => ({ workspaces: [] }));
|
|
164
178
|
workspace = state.workspaces.find(w => (w.mainAgentId === agentId || w.contributorAgentIds?.includes(agentId)) && w.enable_tracking && !w.archived) ?? null;
|
|
@@ -168,7 +182,7 @@ async function main() {
|
|
|
168
182
|
const provider = process.env.FOLLOW_THROUGH_BRIEF || null;
|
|
169
183
|
const brief = provider ? await json(join(directory, "brief.json")).catch(() => null) : null;
|
|
170
184
|
if (!workspace && !(brief?.enable_inbox && brief?.enable_brief_nudge) && !(native && process.env.FOLLOW_THROUGH_ROOT === "1")) return;
|
|
171
|
-
const context = () => instructions(lease, contributor);
|
|
185
|
+
const context = () => instructions(lease, contributor, workflow);
|
|
172
186
|
const sessionText = async () => [workspace ? context() : null, ...await nativeExtras(brief)].filter(Boolean).join("\n\n");
|
|
173
187
|
const name = event.hook_event_name;
|
|
174
188
|
if (!["SessionStart", "UserPromptSubmit", "PostToolUse", "Stop"].includes(name)) return;
|
package/server/daemon.ts
CHANGED
|
@@ -154,7 +154,11 @@ async function readSince(client: Daemon, agentId: string, since: Cursor): Promis
|
|
|
154
154
|
return null;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
/** A Paseo project's GitHub repository (owner/name), from its remote key; null for local or non-GitHub projects. */
|
|
158
|
+
export const projectRepo = (key: string) => /^remote:github\.com\/([\w.-]+\/[\w.-]+?)(?:\.git)?$/.exec(key)?.[1] ?? null;
|
|
157
159
|
export class PaseoGateway implements Gateway {
|
|
160
|
+
/** Each discovered workspace's project repository, for its PR workflow before it has PRs. */
|
|
161
|
+
readonly workspaceRepos = new Map<string, string>();
|
|
158
162
|
/** Settings → Agents' "recovery" role; unset or "Same as main agent" copies the main agent. */
|
|
159
163
|
recoveryRole: (() => Promise<RecoveryRole>) | null = null;
|
|
160
164
|
constructor(private connect: typeof withDaemon = withDaemon, private guard = new SessionGuard(join(paseoHome, "plugin-data/session-guard")), private compacting = compactionPending, private histories = new HistoryCache(null), private now = Date.now, readonly directory = new DaemonDirectory(connect, now)) {}
|
|
@@ -217,6 +221,7 @@ export class PaseoGateway implements Gateway {
|
|
|
217
221
|
// sessions can still contribute their PRs without acquiring completion authority.
|
|
218
222
|
const project = projects.find(p => p.projectId === workspace.projectId);
|
|
219
223
|
const repo = project?.projectKind === "git" ? /^remote:github\.com\/([\w.-]+\/[\w.-]+?)(?:\.git)?$/.exec(project.projectKey)?.[1] ?? null : null;
|
|
224
|
+
if (repo) this.workspaceRepos.set(workspace.id, repo); else this.workspaceRepos.delete(workspace.id);
|
|
220
225
|
// Active scope: a dormant workspace stays listed but is never scanned. Within an active one only
|
|
221
226
|
// loaded agents are read, because a timeline read loads the agent (see isLoaded).
|
|
222
227
|
row.active = workspaceActive(roots, existing, windowMs, now);
|
package/server/engine.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import { completionBlockers, type Workspace, type State, type Batch } from "../shared/model";
|
|
3
3
|
import { Store } from "./store";
|
|
4
4
|
import { Github } from "./github";
|
|
5
|
-
import { batchPrompt, tasksFor, isRecovery, needsPrObservations } from "./tasks";
|
|
5
|
+
import { batchPrompt, tasksFor, isRecovery, needsPrObservations, type TaskWording } from "./tasks";
|
|
6
6
|
import { answerRecipients, developerAnswer, syncTaskQuestions } from "./questions";
|
|
7
7
|
import { answerMessage, isOpen as isOpenQuestion, type Question } from "../shared/questions";
|
|
8
8
|
import { reconcileSubmittedStacks } from "./submissions";
|
|
@@ -38,6 +38,23 @@ export interface Gateway {
|
|
|
38
38
|
deliver?(w: Workspace, recipients: string[], text: string, messageId: string): Promise<string>;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Plain-GitHub stacks are chains of base branches: an open PR whose base isn't trunk sits on the tracked PR whose head
|
|
43
|
+
* branch is that base. Fills in parents agents didn't register; never overrides one they did. Graphite PRs are left alone.
|
|
44
|
+
*/
|
|
45
|
+
export function inferBaseChains(w: Workspace): void {
|
|
46
|
+
for (const pr of w.prs) {
|
|
47
|
+
const s = pr.snapshot;
|
|
48
|
+
if (pr.parent || s?.prWorkflow !== "github" || s.state !== "OPEN" || !s.base || s.base === s.trunk) continue;
|
|
49
|
+
const parent = w.prs.find(p => p !== pr && p.repo === pr.repo && p.snapshot?.headBranch === s.base);
|
|
50
|
+
if (!parent) continue;
|
|
51
|
+
// No cycles: the parent must not already sit on this PR.
|
|
52
|
+
let up: string | null = parent.key; const seen = new Set<string>();
|
|
53
|
+
while (up && !seen.has(up)) { if (up === pr.key) break; seen.add(up); up = w.prs.find(p => p.key === up)?.parent ?? null; }
|
|
54
|
+
if (up === pr.key) continue;
|
|
55
|
+
pr.parent = parent.key;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
41
58
|
export class Engine {
|
|
42
59
|
error: string | null = null;
|
|
43
60
|
private recoveryOperations = new Set<Promise<Workspace>>();
|
|
@@ -55,7 +72,7 @@ export class Engine {
|
|
|
55
72
|
async recover(): Promise<void> {
|
|
56
73
|
await this.store.mutate(state => {
|
|
57
74
|
for (const w of state.workspaces) {
|
|
58
|
-
const eligible = tasksFor(w, this.now());
|
|
75
|
+
const eligible = tasksFor(w, this.now(), this.wording);
|
|
59
76
|
for (const b of w.batches.filter(b => b.state === "pending" && !isRecovery(b))) {
|
|
60
77
|
b.tasks = b.tasks.filter(t => t.kind !== "obligation" || eligible.some(e => e.key === t.key && e.fingerprint === t.fingerprint));
|
|
61
78
|
if (!b.tasks.length) { b.state = "cancelled"; b.result = "No triggered task is due. Unscheduled work remains in Tasks."; }
|
|
@@ -64,7 +81,7 @@ export class Engine {
|
|
|
64
81
|
if (["Recovery stopped or failed. Check the recovery agent before retrying.", "Recovery acknowledgment was refused. Check the identity error on this batch."].includes(w.hold ?? "")) w.hold = null;
|
|
65
82
|
}
|
|
66
83
|
|
|
67
|
-
for (const w of state.workspaces) for (const a of w.prActions) if (a.state === "sending") { a.state = "uncertain"; a.result = `Follow-through reloaded before ${a.kind === "request_reviewers" ? "GitHub confirmed the review request" : "Graphite confirmed the action"}. Check state before sending another request.`; }
|
|
84
|
+
for (const w of state.workspaces) for (const a of w.prActions) if (a.state === "sending") { a.state = "uncertain"; a.result = `Follow-through reloaded before ${a.kind === "request_reviewers" ? "GitHub confirmed the review request" : w.prs.some(p => a.prs.includes(p.key) && p.snapshot?.prWorkflow === "github") ? "GitHub confirmed the action" : "Graphite confirmed the action"}. Check state before sending another request.`; }
|
|
68
85
|
for (const w of state.workspaces) for (const q of w.questions) if (q.answer?.delivery.state === "sending") q.answer.delivery = { ...q.answer.delivery, state: "unconfirmed", reason: "Follow-up reloaded before Paseo confirmed the answer. Check the agent's chat before resending." };
|
|
69
86
|
for (const w of state.workspaces) for (const b of w.batches) if (b.state === "sending") {
|
|
70
87
|
b.state = "uncertain";
|
|
@@ -72,6 +89,8 @@ export class Engine {
|
|
|
72
89
|
}
|
|
73
90
|
});
|
|
74
91
|
}
|
|
92
|
+
/** How repair tasks are worded per repository (review-fix command, GitHub restacks). Empty: the original wording. */
|
|
93
|
+
wording: TaskWording = {};
|
|
75
94
|
tick(): Promise<void> {
|
|
76
95
|
if (this.stopped) return Promise.resolve();
|
|
77
96
|
if (this.running) return this.running;
|
|
@@ -114,6 +133,7 @@ export class Engine {
|
|
|
114
133
|
if (observed.snapshot) recordSnapshot(p, observed.snapshot, this.now());
|
|
115
134
|
}
|
|
116
135
|
reconcileSubmittedStacks(w);
|
|
136
|
+
inferBaseChains(w);
|
|
117
137
|
if (w.archived) return;
|
|
118
138
|
this.reconcile(w);
|
|
119
139
|
pruned.push(...pruneUnsent(w));
|
|
@@ -236,7 +256,7 @@ export class Engine {
|
|
|
236
256
|
const w = findWorkspace(state, workspaceId);
|
|
237
257
|
const b = w.batches.find(b => b.id === batchId);
|
|
238
258
|
if (this.stopped || !w.enable_tracking || w.archived || w.hold || (automatic && !w.enable_auto_sends) || !b || b.state !== "pending" || w.batches.some(other => other.id !== b.id && !isRecovery(other) && ["sending", "sent", "blocked", "uncertain"].includes(other.state))) throw new Error("Workspace or queue changed; refresh before sending");
|
|
239
|
-
const eligible = tasksFor(w, this.now());
|
|
259
|
+
const eligible = tasksFor(w, this.now(), this.wording);
|
|
240
260
|
if (b.tasks.some(t => t.kind === "obligation" && !eligible.some(e => e.key === t.key && e.fingerprint === t.fingerprint))) throw new Error("Task dependencies changed or deployment evidence expired. Refresh before sending.");
|
|
241
261
|
b.state = "sending";
|
|
242
262
|
return { w, b };
|
|
@@ -307,7 +327,7 @@ export class Engine {
|
|
|
307
327
|
return findWorkspace(await this.store.snapshot(), workspaceId);
|
|
308
328
|
}
|
|
309
329
|
private reconcile(w: Workspace): void {
|
|
310
|
-
const tasks = tasksFor(w, this.now());
|
|
330
|
+
const tasks = tasksFor(w, this.now(), this.wording);
|
|
311
331
|
const delivered = new Set(w.batches.filter(b => ["sending", "sent", "completed", "blocked", "uncertain"].includes(b.state)).flatMap(b => b.tasks.map(t => `${t.key}:${t.fingerprint}`)));
|
|
312
332
|
const fresh = tasks.filter(t => !delivered.has(`${t.key}:${t.fingerprint}`));
|
|
313
333
|
let pending = w.batches.find(b => b.state === "pending" && !isRecovery(b));
|