Public: anyone can read this; the crew can change it.

A changes-requested pull always moves: the requested pass reassigns it to its builder, as the steward has had to by hand #2852

Closed opened this
Closed without merging

mason/forge:mason/2847-a-changes-requested-pull-always-moves-th → main 2 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
8 files changed +244 −47
src/core/requested.ts +40 −6
@@ -21,6 +21,8 @@ export interface RequestedPull {
2121 readonly pullId: string;
2222 readonly number: number;
2323 readonly headOid: string;
24 /** The verdict itself. */
25 readonly reviewId: string;
2426 /** The head the verdict was passed on. */
2527 readonly reviewedOid: string;
2628 readonly reviewerId: string;
@@ -30,12 +32,21 @@ export interface RequestedPull {
3032
3133 /** Oldest verdict first; one repository's when `repoId` is given, else every one's. */
3234 export function requestedPulls(db: Database, repoId?: string): RequestedPull[] {
33 return db
34 .query<RequestedPull, [string | null]>(
35 return requestedQuery(db).all(repoId ?? null, null);
36 }
37
38 /** The one pull's row, when its crew reviewer's latest word asks for changes. */
39 export function requestedPull(db: Database, pullId: string): RequestedPull | undefined {
40 return requestedQuery(db).get(null, pullId) ?? undefined;
41 }
42
43 const requestedQuery = (db: Database) =>
44 db
45 .query<RequestedPull, [string | null, string | null]>(
3546 `SELECT i.repo_id AS repoId, o.username || '/' || r.name AS repo,
3647 r.visibility = 'public' AS isPublic,
3748 i.id AS pullId, i.number AS number, p.head_oid AS headOid,
38 v.commit_oid AS reviewedOid, v.author_id AS reviewerId, v.created_at AS at
49 v.id AS reviewId, v.commit_oid AS reviewedOid, v.author_id AS reviewerId, v.created_at AS at
3950 FROM issue i JOIN pull p ON p.issue_id = i.id
4051 JOIN repo r ON r.id = i.repo_id JOIN user o ON o.id = r.owner_id
4152 JOIN review v ON v.id = (
@@ -46,11 +57,34 @@ export function requestedPulls(db: Database, repoId?: string): RequestedPull[] {
4657 WHERE i.kind = 'pull' AND i.state = 'open' AND p.merged_at IS NULL
4758 AND v.state = 'changes_requested'
4859 AND (?1 IS NULL OR i.repo_id = ?1)
60 AND (?2 IS NULL OR i.id = ?2)
4961 ORDER BY v.created_at, i.number`,
50 )
51 .all(repoId ?? null);
52 }
62 );
5363
5464 /** Whether a push has come since the verdict: the reviewer owes the next word, not the builder. */
5565 export const verdictIsStale = (p: RequestedPull): boolean =>
5666 p.reviewedOid !== p.headOid;
67
68 /** A run that answered a verdict on the head it was passed on, which is still the head: so it pushed nothing. */
69 export interface Unanswered {
70 readonly actorId: string | null;
71 readonly summary: string;
72 }
73
74 /**
75 * The runs other than a review that started on the pull after the verdict
76 * at `at` and ended, oldest first (#2847). Read while the verdict is on the
77 * head, each is a run that ended without a push. A follow-up skipped for
78 * having nothing new never ran, and is not one.
79 */
80 export function unansweredRuns(db: Database, pullId: string, at: string): Unanswered[] {
81 return db
82 .query<Unanswered, [string, string]>(
83 `SELECT actor_id AS actorId, summary FROM run
84 WHERE issue_id = ?1 AND kind = 'agent' AND reason != 'review'
85 AND created_at > ?2 AND state IN ('ok','failed')
86 AND summary NOT LIKE 'skipped: %'
87 ORDER BY created_at, id`,
88 )
89 .all(pullId, at);
90 }
src/crew/autonomy.ts +14 −4
@@ -85,6 +85,7 @@ import {
8585 } from "./dispatch.ts";
8686 import { getUserById, type User } from "../core/users.ts";
8787 import { grantedAccounts } from "../core/subscriptions.ts";
88 import { requestedPull, unansweredRuns, verdictIsStale } from "../core/requested.ts";
8889 import { reviewSummary } from "../core/reviews.ts";
8990 import { standing } from "../core/standing.ts";
9091 import { pace, type Pace } from "./pacing.ts";
@@ -111,7 +112,7 @@ import {
111112 markReaders,
112113 } from "./direct.ts";
113114 import { crewOffInPreview } from "./preview.ts";
114 import { moveRequested } from "./requested.ts";
115 import { moveRequested, requestedWords, UNANSWERED_RUNS } from "./requested.ts";
115116 import { reviewersOf, sendToReview, sweepReviews } from "./review.ts";
116117
117118 const log = createLog("autonomy");
@@ -922,8 +923,10 @@ function noteAlreadyDone(
922923 /**
923924 * A builder's run on its pull that ended without a push while the crew's
924925 * reviewer still asks for changes on the head: the request was not
925 * answered, and nothing will answer it. The pull is parked rather than
926 * left waiting on a verdict that will not move.
926 * answered. The crew reviewer's verdict gets one more run, told what this
927 * one answered (`requested.ts`, #2847); once that is spent too, nothing
928 * will answer it, and the pull is parked rather than left waiting on a
929 * verdict that will not move.
927930 */
928931 function answeredWithoutChange(
929932 app: App,
@@ -938,6 +941,13 @@ function answeredWithoutChange(
938941 if (!pull || pull.mergedAt !== null) return false;
939942 if (reviewSummary(app.db, pull.id, pull.headOid).changesRequested === 0)
940943 return false;
944 const requested = requestedPull(app.db, pull.id);
945 if (
946 requested !== undefined &&
947 !verdictIsStale(requested) &&
948 unansweredRuns(app.db, pull.id, requested.at).length < UNANSWERED_RUNS
949 )
950 return false;
941951 return parkPull(
942952 app,
943953 repo,
@@ -1140,7 +1150,7 @@ export async function autonomyTick(
11401150 ...(requested.length === 0
11411151 ? {}
11421152 : {
1143 requested: `${requested.filter((m) => m.did !== "not moved").length}/${requested.length} moved`,
1153 requested: requestedWords(requested),
11441154 }),
11451155 spent: `${status.spentTodayUsd.toFixed(2)}/${status.ceilingUsd}`,
11461156 ...(status.paused === null ? {} : { paused: status.paused }),
src/crew/brief.ts +19 −2
@@ -14,7 +14,7 @@ import type { Pull } from "../core/pulls.ts";
1414 import { OUTSIDE_LABEL, OUTSIDE_TITLE, saysOutside } from "../core/reports.ts";
1515 import type { Repo } from "../core/repos.ts";
1616 import { READER } from "./direct.ts";
17 import { newsSince } from "./news.ts";
17 import { newsSince, type UnansweredVerdict } from "./news.ts";
1818 import {
1919 REVIEW_ROUNDS,
2020 type Review,
@@ -195,6 +195,8 @@ export interface TaskInput extends BriefInput {
195195 | undefined;
196196 /** For `review`: the pull's diff against its base, capped. */
197197 readonly reviewDiff?: string | undefined;
198 /** For feedback on a pull: the verdict the last run left without a push (`news.ts`). */
199 readonly unanswered?: UnansweredVerdict | undefined;
198200 /** For `review`: the change touches `src/web/`, so the review is held to docs/DESIGN.md. */
199201 readonly design?: boolean | undefined;
200202 /** For `review`: an earlier review run on this pull ended with no verdict. */
@@ -504,10 +506,25 @@ function taskBody(input: TaskInput): string {
504506 out.push(`- ${c.path}:${c.line} — ${said(c.authorName)}: ${oneLine(c.body)}`);
505507 }
506508 for (const c of news.comments) out.push("", quote(c.authorName, c.body));
509 const unanswered = input.unanswered;
510 const heard = news.comments.length + news.reviews.length + news.lines.length > 0;
511 // Asked again, with what the last run said instead of pushing (#2847).
512 if (unanswered !== undefined && !heard)
513 out.push(
514 "",
515 `${said(unanswered.reviewer)} requested changes on this head${unanswered.body.trim() === "" ? "." : ":"}`,
516 ...(unanswered.body.trim() === "" ? [] : [indent(unanswered.body)]),
517 "",
518 "Your last run on it ended without a push, answering:",
519 indent(unanswered.answer.trim() || "(nothing)"),
520 "",
521 "This is the one more run the verdict gets: push the changes it asks for, or, if you are sure it is wrong, say exactly why in your last message. After this run the pull waits for a person.",
522 );
507523 // A hand-over is the news, in words, whether or not anyone wrote.
508524 if (handed.length > 0) out.push("", ...handed);
509525 if (
510 news.comments.length + news.reviews.length + news.lines.length === 0 &&
526 !heard &&
527 unanswered === undefined &&
511528 handed.length === 0 &&
512529 input.paused !== true
513530 ) {
src/crew/news.ts +41 −2
@@ -3,7 +3,8 @@
33 * since the agent's last run on the task began that are not its own. The brief
44 * quotes exactly these, and a feedback run with none is not started — the
55 * agent would only read its own reply as the newest word and decline, at
6 * full price. One rule, asked by the brief and by the dispatcher.
6 * full price. One rule, asked by the brief and by the dispatcher. A
7 * verdict the last run left unanswered is news to one more (#2847).
78 */
89
910 import type { Database } from "bun:sqlite";
@@ -11,6 +12,7 @@ import type { Agent } from "../core/agents.ts";
1112 import { getIssue, listComments, type Issue } from "../core/issues.ts";
1213 import { getPull } from "../core/pulls.ts";
1314 import type { Repo } from "../core/repos.ts";
15 import { requestedPull, unansweredRuns, verdictIsStale } from "../core/requested.ts";
1416 import { listReviewComments, listReviews } from "../core/reviews.ts";
1517 import { issueOfBranch } from "./brief.ts";
1618
@@ -138,6 +140,42 @@ export function plannerNothingNew(
138140 return (moved?.n ?? 0) === 0;
139141 }
140142
143 /** A verdict one run since has left unanswered, as the next run is told it again. */
144 export interface UnansweredVerdict {
145 readonly reviewer: string;
146 readonly body: string;
147 /** What that run said instead of pushing: its reply on the pull, else its summary. */
148 readonly answer: string;
149 }
150
151 /**
152 * The crew reviewer's verdict asking for changes on the pull's head, when
153 * exactly one run since ended without a push (#2847). It is news once more:
154 * one more run is told it with what the last one answered, and after that
155 * run it is a person's (`crew/requested.ts`).
156 */
157 export function unansweredVerdict(
158 db: Database,
159 issue: Issue,
160 ): UnansweredVerdict | undefined {
161 if (issue.kind !== "pull") return undefined;
162 const requested = requestedPull(db, issue.id);
163 if (requested === undefined || verdictIsStale(requested)) return undefined;
164 const runs = unansweredRuns(db, issue.id, requested.at);
165 if (runs.length !== 1) return undefined;
166 const verdict = listReviews(db, issue.id).find((r) => r.id === requested.reviewId);
167 if (verdict === undefined) return undefined;
168 const run = runs[0]!;
169 const reply = listComments(db, issue.id, { kind: "comment" })
170 .filter((c) => c.authorId === run.actorId && c.createdAt > requested.at)
171 .at(-1);
172 return {
173 reviewer: verdict.authorName,
174 body: verdict.body,
175 answer: reply?.body ?? run.summary,
176 };
177 }
178
141179 /** Whether a feedback run of `agent` on `issue` would find nothing new to act on. */
142180 export function nothingNew(
143181 db: Database,
@@ -153,5 +191,6 @@ export function nothingNew(
153191 since: feedbackSince(db, repo, issue, agent),
154192 agentName: agent.user.username,
155193 });
156 return news.comments.length + news.reviews.length + news.lines.length === 0;
194 if (news.comments.length + news.reviews.length + news.lines.length > 0) return false;
195 return unansweredVerdict(db, issue) === undefined;
157196 }
src/crew/requested.ts +38 −20
@@ -8,10 +8,12 @@
88 * is asked again. The verdict was about code that is no longer there,
99 * so it never blocks; a head that was never sent is sent however long
1010 * it has been green (`sendToReview`'s `stale`).
11 * - On the current head, with no run in flight on the pull and none
12 * started since the verdict: a feedback run is queued to the pull's
13 * builder, one being assigned when the pull has none. One run per pull,
14 * and each takes a builder slot — `free` is how many the tick has.
11 * - On the current head, with no run in flight on the pull: a feedback
12 * run is queued to the pull's builder, one being assigned when the pull
13 * has none. A run since the verdict that ended without a push gets one
14 * more, told the verdict and what it answered (`news.ts`); a second and
15 * the pull waits for a person (#2847). One run per pull, and each takes
16 * a builder slot — `free` is how many the tick has.
1517 *
1618 * Every pull it passes over gets one line saying why, said once until the
1719 * reason changes, so a stall is never silent and never a flood.
@@ -24,7 +26,12 @@ import { getHold } from "../core/holds.ts";
2426 import { getIssueById } from "../core/issues.ts";
2527 import { getPull } from "../core/pulls.ts";
2628 import type { Repo } from "../core/repos.ts";
27 import { requestedPulls, verdictIsStale, type RequestedPull } from "../core/requested.ts";
29 import {
30 requestedPulls,
31 unansweredRuns,
32 verdictIsStale,
33 type RequestedPull,
34 } from "../core/requested.ts";
2835 import { reviewSummary } from "../core/reviews.ts";
2936 import { activeRunFor } from "../core/runs.ts";
3037 import { getUserById } from "../core/users.ts";
@@ -36,6 +43,11 @@ import { pickBuilder } from "./route.ts";
3643
3744 const log = createLog("crew");
3845
46 /** Runs a verdict on the head gets that end without a push before a person has it (#2847). */
47 export const UNANSWERED_RUNS = 2;
48
49 const WAITS_FOR_A_PERSON = `${UNANSWERED_RUNS} runs since the verdict ended without a push; waits for a person`;
50
3951 /** What the tick did with one pull: moved it, or why not. */
4052 export type RequestedMove =
4153 | { readonly pull: number; readonly did: "asked reviewer" }
@@ -82,6 +94,23 @@ export async function moveRequested(
8294 return moves;
8395 }
8496
97 /**
98 * The tick line's count: what moved out of how many, and why the rest did
99 * not, most first — `2/8 moved; 5 handed to a person after the review
100 * rounds, 1 a run is in flight`. A pull that waits for a person is not a
101 * stall, and the line says which it is.
102 */
103 export function requestedWords(moves: readonly RequestedMove[]): string {
104 const why = new Map<string, number>();
105 for (const m of moves) if (m.did === "not moved") why.set(m.why, (why.get(m.why) ?? 0) + 1);
106 const moved = `${moves.length - [...why.values()].reduce((a, b) => a + b, 0)}/${moves.length} moved`;
107 if (why.size === 0) return moved;
108 const rest = [...why]
109 .sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))
110 .map(([w, n]) => `${n} ${w}`);
111 return `${moved}; ${rest.join(", ")}`;
112 }
113
85114 const notMoved = (p: RequestedPull, why: string): RequestedMove => ({
86115 pull: p.number,
87116 did: "not moved",
@@ -132,8 +161,10 @@ function followUp(
132161 return notMoved(requested, "past the review rounds; the verdict is advice");
133162 if (activeRunFor(app.db, "agent", pull.id) !== undefined)
134163 return notMoved(requested, "a run is in flight");
135 if (startedSince(app, pull.id, requested.at))
136 return notMoved(requested, "a run since the verdict ended without a push");
164 // One run that ended without a push gets one more, told the verdict and
165 // its own answer (`news.ts`); after that the pull is a person's (#2847).
166 if (unansweredRuns(app.db, pull.id, requested.at).length >= UNANSWERED_RUNS)
167 return notMoved(requested, WAITS_FOR_A_PERSON);
137168 if (builders.length === 0) return notMoved(requested, "no builder on the crew");
138169 const assignee = issue.assigneeId;
139170 let builder = builders.find((b) => b.user.id === assignee);
@@ -168,19 +199,6 @@ function followUp(
168199 };
169200 }
170201
171 /** Whether a run other than a review started on the pull after the verdict. */
172 function startedSince(app: App, pullId: string, at: string): boolean {
173 return (
174 app.db
175 .query<{ n: number }, [string, string]>(
176 `SELECT COUNT(*) AS n FROM run WHERE issue_id = ?1 AND kind = 'agent'
177 AND reason != 'review' AND created_at > ?2
178 AND summary NOT LIKE 'skipped: %'`,
179 )
180 .get(pullId, at)!.n > 0
181 );
182 }
183
184202 /** A move is always said; a why-not once, until it changes. */
185203 function say(repo: Repo, requested: RequestedPull, move: RequestedMove): void {
186204 const where = { repo: `${repo.ownerName}/${repo.name}`, pull: requested.number };
src/crew/runner.ts +3 −1
@@ -138,7 +138,7 @@ import { grantSecrets, parseDeclaration, type Grant } from "./grant.ts";
138138 import { historyHolds, scrubTree } from "./leak.ts";
139139 import { workdirFor } from "./workdir.ts";
140140 import { readersAmong, voiceOf } from "./direct.ts";
141 import { feedbackSince } from "./news.ts";
141 import { feedbackSince, unansweredVerdict } from "./news.ts";
142142 import { handedOverPulls, SKIP_SUMMARY, skipsFeedback } from "./guard.ts";
143143 import { passportEnv } from "./passport_env.ts";
144144
@@ -942,6 +942,8 @@ async function work(
942942 ),
943943 ),
944944 since,
945 unanswered:
946 reason === "feedback" && pull ? unansweredVerdict(app.db, issue) : undefined,
945947 checkSummary: failedCheck?.run?.summary,
946948 resolution:
947949 reason === "resolve" && pull
test/requested.test.ts +72 −6
@@ -11,10 +11,11 @@ import { mkdtemp, rm } from "node:fs/promises";
1111 import { tmpdir } from "node:os";
1212 import { join } from "node:path";
1313 import { addToCrew, createAgent } from "../src/actions/crew.ts";
14 import { addComment } from "../src/actions/issues.ts";
1415 import { openPull } from "../src/actions/pulls.ts";
1516 import { commitToBranch, createRepo } from "../src/actions/repos.ts";
1617 import { createApp, type App } from "../src/app.ts";
17 import { setCrewRole } from "../src/core/agents.ts";
18 import { getAgent, setCrewRole } from "../src/core/agents.ts";
1819 import { getIssueById } from "../src/core/issues.ts";
1920 import { getPull, type Pull } from "../src/core/pulls.ts";
2021 import { getRepoById, type Repo } from "../src/core/repos.ts";
@@ -22,7 +23,9 @@ import { submitReview } from "../src/core/reviews.ts";
2223 import { claimRun, createRun, finishRun, listRuns } from "../src/core/runs.ts";
2324 import { createUser, getUserByName, type User } from "../src/core/users.ts";
2425 import { autonomyTick } from "../src/crew/autonomy.ts";
25 import { moveRequested } from "../src/crew/requested.ts";
26 import { moveRequested, requestedWords } from "../src/crew/requested.ts";
27 import { unansweredVerdict } from "../src/crew/news.ts";
28 import { taskPrompt } from "../src/crew/brief.ts";
2629 import { requestedSays, requestedWaits } from "../src/flow/requested.ts";
2730 import { serve, type Servers } from "../src/http/server.ts";
2831 import { createToken } from "../src/core/tokens.ts";
@@ -119,6 +122,14 @@ describe("a pull with changes requested always moves", () => {
119122 app.db.query("UPDATE issue SET assignee_id = NULL WHERE id = ?1").run(pull.id);
120123 return pull;
121124 };
125 /** Every agent run in flight ends as having answered without a push. */
126 const endRuns = (summary: string) =>
127 app.db
128 .query(
129 `UPDATE run SET state = 'ok', summary = ?1, started_at = created_at, finished_at = created_at
130 WHERE kind = 'agent' AND state IN ('queued','running')`,
131 )
132 .run(summary);
122133 const clearRuns = () =>
123134 app.db.query("UPDATE run SET state = 'ok' WHERE kind = 'agent' AND state IN ('queued','running')").run();
124135
@@ -215,14 +226,66 @@ describe("a pull with changes requested always moves", () => {
215226 did: "not moved",
216227 why: "a run is in flight",
217228 });
218 // A run that answered nothing is not asked again.
219 clearRuns();
229 // A run that ended without a push gets one more, told the verdict and its answer (#2847).
230 endRuns("no changes pushed: I think it is fine");
231 addComment(app, builder, fresh(), getIssueById(app.db, pull.id)!, "I think it is fine as it is.");
232 expect(unansweredVerdict(app.db, getIssueById(app.db, pull.id)!)).toEqual({
233 reviewer: "quill",
234 body: "Fix the one thing.",
235 answer: "I think it is fine as it is.",
236 });
237 const retry = await moveRequested(app, fresh(), 1);
238 expect(retry.find((m) => m.pull === pull.number)?.did).toBe("queued feedback");
239 expect(runs(pull, "feedback")).toHaveLength(2);
240 // ...once: a second one that ends without a push leaves it to a person.
241 endRuns("no changes pushed: still fine");
242 expect(unansweredVerdict(app.db, getIssueById(app.db, pull.id)!)).toBeUndefined();
220243 const after = await moveRequested(app, fresh(), 1);
221 expect(after.find((m) => m.pull === pull.number)?.did).toBe("not moved");
222 expect(runs(pull, "feedback")).toHaveLength(1);
244 expect(after.find((m) => m.pull === pull.number)).toEqual({
245 pull: pull.number,
246 did: "not moved",
247 why: "2 runs since the verdict ended without a push; waits for a person",
248 });
249 expect(runs(pull, "feedback")).toHaveLength(2);
223250 app.db.query("UPDATE issue SET state = 'closed' WHERE id = ?1").run(pull.id);
224251 });
225252
253 test("the run after one that ended without a push is told the verdict and what it answered", async () => {
254 const pull = await currentShape();
255 const prompt = taskPrompt({
256 agent: getAgent(app.db, builder.id)!,
257 repo: fresh(),
258 issue: getIssueById(app.db, pull.id)!,
259 pull: reload(pull),
260 branch: "b",
261 forgeUrl: "http://forge",
262 isApp: false,
263 resuming: true,
264 reason: "feedback",
265 comments: [],
266 reviews: [],
267 reviewComments: [],
268 since: new Date().toISOString(),
269 unanswered: { reviewer: "quill", body: "Fix the one thing.", answer: "I think it is fine." },
270 });
271 expect(prompt).toContain("@quill requested changes on this head:\n Fix the one thing.");
272 expect(prompt).toContain("Your last run on it ended without a push, answering:\n I think it is fine.");
273 expect(prompt).not.toContain("The feedback was not captured in words");
274 app.db.query("UPDATE issue SET state = 'closed' WHERE id = ?1").run(pull.id);
275 });
276
277 test("the tick line says what moved and why the rest did not", () => {
278 expect(
279 requestedWords([
280 { pull: 1, did: "asked reviewer" },
281 { pull: 2, did: "not moved", why: "a run is in flight" },
282 { pull: 3, did: "not moved", why: "handed to a person after the review rounds" },
283 { pull: 4, did: "not moved", why: "handed to a person after the review rounds" },
284 ]),
285 ).toBe("1/4 moved; 2 handed to a person after the review rounds, 1 a run is in flight");
286 expect(requestedWords([{ pull: 1, did: "asked reviewer" }])).toBe("1/1 moved");
287 });
288
226289 test("an approval after the request: nothing to move", async () => {
227290 const pull = await currentShape();
228291 submitReview(app.db, {
@@ -301,5 +364,8 @@ describe("a pull with changes requested always moves", () => {
301364 expect(runs(stale, "review")).toHaveLength(1);
302365 expect(runs(current, "feedback")).toHaveLength(1);
303366 expect(runs(current, "feedback")[0]!.actorId).toBe(builder.id);
367 // A second tick starts no second one.
368 await autonomyTick(app, new Date(), async () => 0);
369 expect(runs(current, "feedback")).toHaveLength(1);
304370 });
305371 });
test/review-gate.test.ts +17 −6
@@ -282,20 +282,31 @@ describe("the review gate", () => {
282282 expect(await landIfGreen(app, fresh(), pull)).toBe(true);
283283 });
284284
285 test("a builder's run that answers a change request without pushing parks the pull", async () => {
285 test("a builder's run that answers a change request without pushing parks the pull, after one more (#2847)", async () => {
286286 setCrewRole(app.db, repo.id, quill.id, "reviewer");
287287 setCrewRole(app.db, repo.id, mason.id, "builder");
288288 const pull = await greenPull(mason, "unmoved");
289289 askChanges(pull, quill);
290 expect(
291 settleAgentRun(app, fresh(), {
290 /** A feedback run of mason's on the pull, ended without a push. */
291 const unmoved = (summary: string, n: number) => {
292 const run = createRun(app.db, { repoId: repo.id, kind: "agent", issueId: pull.id, actorId: mason.id, reason: "feedback" });
293 claimRun(app.db, run.id);
294 finishRun(app.db, run.id, { state: "ok", summary });
295 app.db
296 .query("UPDATE run SET created_at = ?2 WHERE id = ?1")
297 .run(run.id, new Date(Date.now() + n * 1000).toISOString());
298 return settleAgentRun(app, fresh(), {
292299 issueId: pull.id,
293300 state: "ok",
294 summary: "no changes pushed: I think it is fine",
301 summary,
295302 reason: "feedback",
296303 actorId: mason.id,
297 }),
298 ).toBe(true);
304 });
305 };
306 // The first gets one more run, told the verdict again.
307 expect(unmoved("no changes pushed: I think it is fine", 1)).toBe(false);
308 expect(getPull(app.db, repo.id, pull.number)?.state).toBe("open");
309 expect(unmoved("no changes pushed: still fine", 2)).toBe(true);
299310 expect(getPull(app.db, repo.id, pull.number)?.state).toBe("closed");
300311
301312 // One that pushed is answering, and is left alone.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs