mergestorm 0.3.24 → 0.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/client/index.d.ts +4 -3
- package/dist/client/index.js +4 -3
- package/dist/commands/queue.js +5 -1
- package/dist/commands/registry.js +1 -1
- package/dist/commands/stack.d.ts +8 -0
- package/dist/commands/stack.js +68 -7
- package/dist/shell.js +1 -1
- package/dist/stack-blockers.d.ts +54 -2
- package/dist/stack-blockers.js +139 -6
- package/dist/stack-dto.d.ts +17 -0
- package/dist/stack-dto.js +28 -0
- package/dist/stack-watch-obligation.d.ts +43 -0
- package/dist/stack-watch-obligation.js +79 -0
- package/dist/stack-watch.d.ts +8 -1
- package/dist/stack-watch.js +44 -23
- package/dist/ui/ansi.d.ts +14 -1
- package/dist/ui/ansi.js +25 -5
- package/dist/ui/banner.d.ts +2 -1
- package/dist/ui/banner.js +26 -47
- package/dist/ui/logo.d.ts +13 -8
- package/dist/ui/logo.js +25 -13
- package/dist/ui/prompt.d.ts +11 -1
- package/dist/ui/prompt.js +92 -9
- package/package.json +1 -1
- package/skill/SKILL.md +2 -2
- package/skill/mergestorm-bounce-watch/SKILL.md +8 -4
- package/skill/mergestorm-pr-loop/SKILL.md +3 -3
package/dist/ui/prompt.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { PassThrough } from "node:stream";
|
|
2
|
+
import { StringDecoder } from "node:string_decoder";
|
|
1
3
|
import * as readline from "node:readline";
|
|
2
4
|
import { createInterface } from "node:readline/promises";
|
|
3
5
|
import { stdin, stdout } from "node:process";
|
|
@@ -37,6 +39,13 @@ export function promptClearOverlay(boxed) {
|
|
|
37
39
|
* frame's row count is unknowable after the terminal rewraps.
|
|
38
40
|
*/
|
|
39
41
|
export const HEADER_REDRAW_PREFIX = `\u001b[H${clearDown}`;
|
|
42
|
+
export const MOUSE_ENABLE = "\u001b[?1000h\u001b[?1006h";
|
|
43
|
+
export const MOUSE_DISABLE = "\u001b[?1000l\u001b[?1006l";
|
|
44
|
+
/** SGR coordinates and the rectangle are both 1-based. */
|
|
45
|
+
export function hitTestSprite(col, row, rect) {
|
|
46
|
+
return col >= rect.col && col < rect.col + rect.width &&
|
|
47
|
+
row >= rect.row && row < rect.row + rect.height;
|
|
48
|
+
}
|
|
40
49
|
export const DROPDOWN_MAX_COMMAND_ROWS = 8;
|
|
41
50
|
export function formatSlashLabel(spec) {
|
|
42
51
|
const extra = spec.aliases?.length
|
|
@@ -171,9 +180,10 @@ export function fitHomeFrame(params) {
|
|
|
171
180
|
: params.miniHeader?.length
|
|
172
181
|
? params.miniHeader
|
|
173
182
|
: [];
|
|
183
|
+
const header = fallback.slice(0, Math.max(0, rows - 1));
|
|
174
184
|
return {
|
|
175
|
-
header
|
|
176
|
-
reserve: params.dockBottom ? Math.max(0, rows -
|
|
185
|
+
header,
|
|
186
|
+
reserve: params.dockBottom ? Math.max(0, rows - header.length - 1) : 0,
|
|
177
187
|
boxed: false,
|
|
178
188
|
hasPrompt: false,
|
|
179
189
|
hasHint: false,
|
|
@@ -338,7 +348,72 @@ export async function askLine(opts) {
|
|
|
338
348
|
let exitHint = false;
|
|
339
349
|
const ctrlCExit = new CtrlCExitGate();
|
|
340
350
|
const wasRaw = Boolean(input.isRaw);
|
|
341
|
-
|
|
351
|
+
// Decode keys from a private stream after removing mouse reports. Readline
|
|
352
|
+
// otherwise emits the numeric tail of SGR reports as ordinary typing.
|
|
353
|
+
// Never listen for `keypress` on `input` itself: once any TUI has called
|
|
354
|
+
// emitKeypressEvents(stdin), stdin decodes keys too and every character
|
|
355
|
+
// (and every mouse report) would land in the buffer twice.
|
|
356
|
+
const keys = new PassThrough();
|
|
357
|
+
const decoder = new StringDecoder("utf8");
|
|
358
|
+
let pending = "";
|
|
359
|
+
let escapeTimer;
|
|
360
|
+
readline.emitKeypressEvents(keys);
|
|
361
|
+
keys.on("keypress", onKeypress);
|
|
362
|
+
function onData(chunk) {
|
|
363
|
+
if (finished)
|
|
364
|
+
return;
|
|
365
|
+
if (escapeTimer)
|
|
366
|
+
clearTimeout(escapeTimer);
|
|
367
|
+
pending += typeof chunk === "string" ? chunk : decoder.write(chunk);
|
|
368
|
+
while (pending && !finished) {
|
|
369
|
+
const start = pending.indexOf("\u001b");
|
|
370
|
+
if (start !== 0) {
|
|
371
|
+
const end = start < 0 ? pending.length : start;
|
|
372
|
+
const text = pending.slice(0, end);
|
|
373
|
+
pending = pending.slice(end);
|
|
374
|
+
keys.write(text);
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
if (pending.startsWith("\u001b[M")) {
|
|
378
|
+
if (pending.length < 6)
|
|
379
|
+
return;
|
|
380
|
+
pending = pending.slice(6);
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
const mouse = /^\u001b\[<(\d+);(\d+);(\d+)([Mm])/.exec(pending);
|
|
384
|
+
if (mouse) {
|
|
385
|
+
pending = pending.slice(mouse[0].length);
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
const partialMouse = /^\u001b\[<\d*(?:;\d*){0,2}/.exec(pending);
|
|
389
|
+
if (partialMouse && pending.length > partialMouse[0].length) {
|
|
390
|
+
pending = pending.slice(partialMouse[0].length);
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
const csi = /^\u001b\[[0-?]*[ -/]*[@-~]/.exec(pending);
|
|
394
|
+
const ss3 = /^\u001bO[ -~]/.exec(pending);
|
|
395
|
+
if (csi || ss3) {
|
|
396
|
+
const sequence = csi?.[0] ?? ss3[0];
|
|
397
|
+
pending = pending.slice(sequence.length);
|
|
398
|
+
keys.write(sequence);
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
if (pending === "\u001b" ||
|
|
402
|
+
/^\u001b(?:\[[0-?]*[ -/]*|O?)$/.test(pending)) {
|
|
403
|
+
// Keep partial mouse reports across chunks. A lone Escape still works.
|
|
404
|
+
if (!pending.startsWith("\u001b[<")) {
|
|
405
|
+
escapeTimer = setTimeout(() => {
|
|
406
|
+
const text = pending;
|
|
407
|
+
pending = "";
|
|
408
|
+
keys.write(text);
|
|
409
|
+
}, 50);
|
|
410
|
+
}
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
keys.write(pending[0]);
|
|
414
|
+
pending = pending.slice(1);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
342
417
|
input.setRawMode(true);
|
|
343
418
|
input.resume();
|
|
344
419
|
function currentDropdown() {
|
|
@@ -408,9 +483,8 @@ export async function askLine(opts) {
|
|
|
408
483
|
// Never write more rows than the pane — that scrolls the welcome
|
|
409
484
|
// tail (tips / what's new) into view and looks like a broken frame.
|
|
410
485
|
if (frame.rows.length > roomRows) {
|
|
411
|
-
const
|
|
412
|
-
|
|
413
|
-
frame.rows = keep;
|
|
486
|
+
const shift = frame.rows.length - roomRows;
|
|
487
|
+
frame.rows = frame.rows.slice(shift);
|
|
414
488
|
frame.inputRow = Math.max(0, frame.inputRow - shift);
|
|
415
489
|
}
|
|
416
490
|
// Home screen owns the pane: always origin + ED 0. Relative CUU after
|
|
@@ -442,7 +516,11 @@ export async function askLine(opts) {
|
|
|
442
516
|
paint();
|
|
443
517
|
}
|
|
444
518
|
function cleanup() {
|
|
445
|
-
|
|
519
|
+
if (escapeTimer)
|
|
520
|
+
clearTimeout(escapeTimer);
|
|
521
|
+
input.removeListener("data", onData);
|
|
522
|
+
keys.removeListener("keypress", onKeypress);
|
|
523
|
+
keys.destroy();
|
|
446
524
|
output.removeListener("resize", onResize);
|
|
447
525
|
input.setRawMode(wasRaw);
|
|
448
526
|
// emitKeypressEvents leaves stdin flowing; pause it so an idle shell
|
|
@@ -599,8 +677,13 @@ export async function askLine(opts) {
|
|
|
599
677
|
finish(null, err);
|
|
600
678
|
}
|
|
601
679
|
}
|
|
602
|
-
input.on("
|
|
680
|
+
input.on("data", onData);
|
|
603
681
|
output.on("resize", onResize);
|
|
604
|
-
|
|
682
|
+
try {
|
|
683
|
+
render();
|
|
684
|
+
}
|
|
685
|
+
catch (err) {
|
|
686
|
+
finish(null, err);
|
|
687
|
+
}
|
|
605
688
|
});
|
|
606
689
|
}
|
package/package.json
CHANGED
package/skill/SKILL.md
CHANGED
|
@@ -68,12 +68,12 @@ Call `review_submit` with `wait: false` (the default) on the repo cwd (git colle
|
|
|
68
68
|
|
|
69
69
|
Optional: `thread`, `idempotency_key`, `wait`, `timeout_s`. Submit returns without waiting. Record `job_id` as soon as it returns, then loop `review_wait` with that `job_id` and `timeout_s: 45` until the job finishes. Each call is one 45s slice. On timeout, call `review_wait` again with the same `job_id`. Do not pass 300; hosts drop long MCP calls. Explicit `wait: true` also defaults to one 45s slice.
|
|
70
70
|
|
|
71
|
-
Call `review_list` before any resubmit, including when a submit or wait call is interrupted. Resume the existing job with `
|
|
71
|
+
Call `review_list` before any resubmit, including when a submit or wait call is interrupted. Resume the existing job with `review_wait` (`timeout_s: 0` reads it once without waiting); do not create a second job because a slice died or the submit response was lost.
|
|
72
72
|
|
|
73
73
|
Status handling:
|
|
74
74
|
|
|
75
75
|
- status is `no_changes`: success. The branch matches the selected base, no review job was submitted, and no review credit was used. Stop unless the user expected a different base.
|
|
76
|
-
- status is `rate_limited`: wait `retry_after_seconds`. Use `review_list
|
|
76
|
+
- status is `rate_limited`: wait `retry_after_seconds`. Use `review_list` or `review_wait` for an existing in-flight job before resubmitting. Do not immediately resubmit the same diff.
|
|
77
77
|
|
|
78
78
|
## Apply findings
|
|
79
79
|
|
|
@@ -7,6 +7,10 @@ description: Watch stacks explicitly named by the human while Auto land is on, a
|
|
|
7
7
|
|
|
8
8
|
Use only these shipped Mergestorm MCP tools: `stack_wait`, `stack_status`, `queue_status`. Use local checkout, test, and Git operations to make the patch. Auto land owns landing.
|
|
9
9
|
|
|
10
|
+
## Not done until landed
|
|
11
|
+
|
|
12
|
+
A stack watch is done only when the stack is landed, or when the human takes it back (archives the stack or tells you to stop). A clean push, a submit, an adopt, or one merged layer is not done: merging a lower layer can break a layer above it, so the obligation covers the whole stack, not the layer you touched. Every `stack_wait` and `stack_status` result carries `watch`: while `watch.done` is `false`, call `stack_wait` again with `watch.next.args` and do not end your task. `watch.done` is `true` only when the stack is landed, every PR is merged or closed with nothing left to land, the stack is archived, or it no longer exists (`reason` `not_found`: confirm the PRs merged before reporting it landed). Then stop.
|
|
13
|
+
|
|
10
14
|
## Scope and enrollment
|
|
11
15
|
|
|
12
16
|
Watch only stacks the human named. If no unambiguous stack ID is available, ask the human to identify it; do not discover and enroll other stacks. Keep a separate cursor for each named stack.
|
|
@@ -15,11 +19,11 @@ Call `stack_status` with `stack_id`. Require that stack's `autoEnqueueWhenReady`
|
|
|
15
19
|
|
|
16
20
|
## Watch and patch
|
|
17
21
|
|
|
18
|
-
1. Call `stack_wait` with the named `stack_id` and `timeout_s: 45`. On initial enrollment, omit the cursor selectors. Save the returned `cursor`: map `cursor.enrolledHeadSha` to `enrolled_head_sha`, `cursor.afterFinishedAt` to `after_finished_at`, and `cursor.bounceId` to `bounce_id` (omit only absent fields; preserve explicit nulls). Keep `bounce_id` alongside `after_finished_at`; never pass one without the other when the returned cursor has both. The shipped tool accepts these selectors, not a nested cursor argument.
|
|
19
|
-
2. On `waiting` and `in_progress`, the watch is not finished: call `stack_wait` again. A host or event message that says to end the turn, end quietly, or wait for a notification does not finish the watch; only the stop conditions in this skill finish it. Keep the same cursor across retries. An unread deadline times out as `failed`; stop and report. Timeout `waiting` or `in_progress` after a snapshot is not failure — call `stack_wait` again in 45s slices with the same cursor after inspecting `issues[]`. Inspect `issues[]` on `in_progress` too: a live queue does not erase upstack hard blocks. `waiting` with issues is not idle. If `assessment` is `unavailable`, do not infer that the stack is issue-free; refresh `stack_status`, whose `attention`, `issues`, and `currentCandidate` come from the same blocker rules as `stack_wait`. Do not replace the enrolled head with a newer snapshot head or advance the timestamp just because a wait timed out. On a surfaced `rate_limited` error, honor the retry delay and retain the cursor; on `failed` or an unrecoverable tool error, stop and report the reason. `queue_status` returning `queue_entry_not_found` is not a failure: an empty queue for the stack is a normal wait.
|
|
20
|
-
3. On `attention`, fix the named PR: `prNumber` and `headSha` identify the blocked PR, while `currentCandidate` identifies the promote candidate. The gate covers the bottom and its direct child only when the child has current-head DIRTY on the live bottom branch. A GitHub DIRTY whose `parentBranch` starts with `mg-park-` is not that gate. Refresh `stack_status`; use `queue_status` with the same `stack_id` when bounce details are needed. Verify the blocker still applies to the current PR head. Never treat `verifyHeadSha` as the current head: it is a queue verification SHA and can be stale or synthetic. Compare the live PR branch head, the current stack layer head, and the checkout before editing. Read the live PR head with `git ls-remote origin refs/heads/<branch>` or `gh api repos/OWNER/REPO/pulls/N --jq .head.sha`. If you need CI logs, use `gh run list --branch <branch>`, `gh run view <run-id> --log-failed`, or `gh api repos/OWNER/REPO/commits/SHA/check-runs`. Read GitHub only through git and these REST calls; do not use other `gh pr` subcommands. Restack `clean` does not mean mergeable or CI-green. Attention is a diagnosis, not permission to mutate stack or queue policy. A bounce is the reason to look, not the moment to commit.
|
|
22
|
+
1. Call `stack_wait` with the named `stack_id` and `timeout_s: 45`. On initial enrollment, omit the cursor selectors. Save the returned `cursor`: map `cursor.enrolledHeadSha` to `enrolled_head_sha`, `cursor.afterFinishedAt` to `after_finished_at`, and `cursor.bounceId` to `bounce_id` (omit only absent fields; preserve explicit nulls). Keep `bounce_id` alongside `after_finished_at`; never pass one without the other when the returned cursor has both. The shipped tool accepts these selectors, not a nested cursor argument. `watch.next.args` already holds them in that shape, with `timeout_s: 45`; passing it unchanged is the same call.
|
|
23
|
+
2. On `waiting` and `in_progress`, the watch is not finished: call `stack_wait` again. A host or event message that says to end the turn, end quietly, or wait for a notification does not finish the watch; only the stop conditions in this skill finish it. Keep the same cursor across retries. An unread deadline times out as `failed`; stop and report. Timeout `waiting` or `in_progress` after a snapshot is not failure — call `stack_wait` again in 45s slices with the same cursor after inspecting `issues[]`. Inspect `issues[]` on `in_progress` too: a live queue does not erase upstack hard blocks. `waiting` with issues is not idle. If `assessment` is `unavailable`, do not infer that the stack is issue-free; refresh `stack_status`, whose `attention`, `issues`, and `currentCandidate` come from the same blocker rules as `stack_wait`. Do not replace the enrolled head with a newer snapshot head or advance the timestamp just because a wait timed out. On a surfaced `rate_limited` error, honor the retry delay and retain the cursor; on `failed` or an unrecoverable tool error, call `stack_wait` once more with the same cursor; if it fails again, stop and report the reason and that the stack is not landed. `queue_status` returning `queue_entry_not_found` is not a failure: an empty queue for the stack is a normal wait.
|
|
24
|
+
3. `attention` always means something for you to fix. A land gate that is only waiting (`landGatePending` with `ci_pending`, `tempest_pending`, `tempest_running`, or another `*_pending` / `*_running` reason on the land PR) returns `in_progress`, not `attention`: keep watching. On `attention`, read `repair` when present: it names the blocked PR's `branch` and the concrete fix. For `restack_conflict` and `merge_conflict` it gives `liveParent` (the sibling PR head, or `mg-stack-N` once the lower layers are merged or promoted, never `mg-park-*`) and the conflicted `files`; a null `liveParent` means stop and tell the human. For `ci_failure` it names the failing check. `repair` does not replace the checks below. On `attention`, fix the named PR: `prNumber` and `headSha` identify the blocked PR, while `currentCandidate` identifies the promote candidate. The gate covers the bottom and its direct child only when the child has current-head DIRTY on the live bottom branch. A GitHub DIRTY whose `parentBranch` starts with `mg-park-` is not that gate. Refresh `stack_status`; use `queue_status` with the same `stack_id` when bounce details are needed. Verify the blocker still applies to the current PR head. Never treat `verifyHeadSha` as the current head: it is a queue verification SHA and can be stale or synthetic. Compare the live PR branch head, the current stack layer head, and the checkout before editing. Read the live PR head with `git ls-remote origin refs/heads/<branch>` or `gh api repos/OWNER/REPO/pulls/N --jq .head.sha`. If you need CI logs, use `gh run list --branch <branch>`, `gh run view <run-id> --log-failed`, or `gh api repos/OWNER/REPO/commits/SHA/check-runs`. Read GitHub only through git and these REST calls; do not use other `gh pr` subcommands. Restack `clean` does not mean mergeable or CI-green. Attention is a diagnosis, not permission to mutate stack or queue policy. A bounce is the reason to look, not the moment to commit. `stack_wait` and `stack_status` hold the blocked PR's attention themselves while Vortex or Cyclone is still working on that PR, whatever the blocker (a red CI failure, a merge conflict, a bounce, Draft, a failed restack or review): they return `in_progress` instead of `attention`, with `busy[]` naming the PR (`prNumber`, `headSha`), the `blocker`, and the `agent` (`vortex` or `cyclone`), and `agents` carrying that PR's `vortexStatus`, `cycloneStatus`, `vortexReview`, and `busy` flags. `in_progress` with a nonempty `busy[]` means do not patch yet: keep calling `stack_wait` with the same cursor until that work has finished and the watch returns `attention`, then make the follow-up commit. You do not need an extra `stack_status` refresh each slice for this check. A nonempty `busy[]` reports still-working agents on that PR's current head. Vortex holds when `vortexReview` is `reviewing` at the head, an unfinished vortex `agentRuns` row at the head is `reviewing`, or an unfinished vortex run at the head is `queued` and started within the last 15 minutes (with no `agentRuns` or `vortexReview` on the layer, `vortexStatus` `reviewing` holds). Cyclone holds when `cycloneStatus` is `patching`, an unfinished cyclone `agentRuns` row is `patching`, or the server sees a live Cyclone patch lease or an open Cyclone check run on the head. `seam_pending` alone, and a `queued` run older than 15 minutes, are not treated as work in progress. `all_clear`, `findings`, `skipped`, `failed`, `throttled`, `awaiting_fix`, and a null status are finished. A queued Vortex run holds for at most 15 minutes; reviewing and patching hold until the run finishes or its lease or check run is cleared. While `busy[]` holds a PR it can hide a blocker no agent will clear, such as a Draft PR. If a hold looks stuck, refresh `stack_status` and tell the human. Do not turn Cyclone off, and do not turn Auto land off or on, to end the wait. If the remote head moves while you wait, stop and tell the human.
|
|
21
25
|
4. Use a clean worktree on that named PR's head branch and record the remote starting SHA. Fix the current blocker with the smallest patch, and run the relevant checks. For conflicts, the live parent is the sibling PR head or the unit branch (`mg-stack-N`, Mergestorm's owned trunk, not an alias for main) — not the DTO `parentBranch` when that field starts with `mg-park-*`. If `parentBranch` is `mg-park-*`, never merge or rebase onto it; if the real live parent is unknown, stop. Otherwise prefer merging that live parent into the PR branch, resolving locally, then an ordinary push. Never use Dashboard Continue. When the live parent is a sibling, never rebase onto trunk or `mg-stack-N` instead. Parked-freeze DIRTY alone needs no conflict patch. Leave GitHub bases as Mergestorm set them: the bottom of a 2+ PR stack is based on `mg-stack-N`, layer 2 on layer 1, PR3+ on `mg-park-*`.
|
|
22
|
-
5. CI-only fixes may run while Cyclone auto-patch is still on for the stack. Auto-patch may stay on, and you still wait until the current Vortex run and the current Cyclone run on that PR have finished before the follow-up commit. When the gate is clean, inspect `issues[]` and fix a live upstack CI failure one PR at a time, refreshing the gate before the next PR. Do not use higher-layer bounce history as a patch target. Do not fight Cyclone: if the remote head moved, stop and tell the human. Do not take over Cyclone's review-finding work while it is active; if the blocker requires that or a policy/queue action rather than a concrete patch, stop and explain what needs human attention.
|
|
26
|
+
5. CI-only fixes may run while Cyclone auto-patch is still on for the stack. Auto-patch may stay on, and you still wait until the current Vortex run and the current Cyclone run on that PR have finished before the follow-up commit. When the gate is clean, inspect `issues[]` and fix a live upstack CI failure one PR at a time, refreshing the gate before the next PR. Do not use higher-layer bounce history as a patch target. Do not fight Cyclone: if the remote head moved, stop and tell the human. Do not take over Cyclone's review-finding work while it is active; if the blocker requires that or a policy/queue action rather than a concrete patch, stop and explain what needs human attention. On a `Seam findings` blocker, read that PR's seam finding, the Vortex review "Integration review — U<n> seam" (`gh api repos/OWNER/REPO/pulls/N/reviews` and `gh api repos/OWNER/REPO/pulls/N/comments`), and patch its concrete findings on that PR's head; a "Decision required" seam finding needs a human, so tell them and do not guess. On `Seam review failed`, do not patch; tell the human, unless a new push already has a seam re-review held in `busy[]`.
|
|
23
27
|
6. Recheck Auto land and the remote PR head (`git ls-remote origin refs/heads/<branch>`) immediately before pushing. Commit the patch and push the PR head with an ordinary push. A rebase onto that same live parent followed by force-with-lease is allowed only if the remote is still exactly the SHA you started from and Cyclone did not move it; use an explicit lease bound to that starting SHA. This exception never permits rebasing onto a parked freeze or substituting trunk / the unit for a sibling parent. If the remote head moved or the push is rejected because it moved, stop; do not rebase and retry.
|
|
24
28
|
7. After your successful push, leave a clean worktree and keep watching the named stack. Start a new watch cycle with `enrolled_head_sha` set to the SHA you pushed. If you handled a bounce, retain the returned `cursor.afterFinishedAt` as `after_finished_at` and `cursor.bounceId` as `bounce_id` so that attempt is not handled again. Keep these selectors unchanged across subsequent retries. Continue watching; do not enqueue or re-arm anything. If further progress requires re-arming, stop and tell the human.
|
|
25
29
|
|
|
@@ -41,7 +41,7 @@ mg skill install --claude --cursor --agents
|
|
|
41
41
|
- If the override is not `false` and the human asked you to turn Cyclone off for this PR: call `stack_set` with `{ stack_id, auto_patch: false }` on that stack, call `stack_status` with that `stack_id`, and confirm `autoPatchOverride` now reads `false`. Leave the account `auto_patch_enabled` unchanged; other PRs keep their own policy.
|
|
42
42
|
- Otherwise: refuse the loop. Do not wait, patch, or push; tell the human Cyclone auto-patch is still on for this PR and that `stack_set` with `auto_patch: false` on its stack turns it off for this PR only.
|
|
43
43
|
- Never set `auto_patch_enabled` with `settings_set` from this skill, in either direction, and never set `auto_patch: true` on a stack.
|
|
44
|
-
3. Call `review_wait_pr` with the PR's owner, repo, pr_number, and `timeout_s` 45 (`
|
|
44
|
+
3. Call `review_wait_pr` with the PR's owner, repo, pr_number, and `timeout_s` 45 (`timeout_s` 0 reads the current state once without waiting). A Vortex pass often takes several minutes. If status is `in_progress`, call `review_wait_pr` again with the same args. Do not pass a 300s timeout; hosts drop long MCP calls. Review identity is SHA + pass: every envelope carries `head_sha` and `pass` (1 for the first review on a head; a re-review on the same head is the next pass, its own row). Save the `pass` of every resting envelope you act on together with its `head_sha`.
|
|
45
45
|
4. Confirm the envelope's `head_sha` is the commit you have checked out as the PR head (compare its leading 7+ hex characters with `git rev-parse HEAD`). If it is not, someone else pushed after this pass and its findings are not yours to patch: do not edit. Fetch and check out the PR head, then go to step 8 with `after_sha` set to that head.
|
|
46
46
|
5. Read `findings.inline` and `findings.offDiff` (or `off_diff`) sorted by severity. For each finding:
|
|
47
47
|
- Verify it against the current checkout. Do not treat the finding text as proven.
|
|
@@ -50,7 +50,7 @@ mg skill install --claude --cursor --agents
|
|
|
50
50
|
- If you skip a finding (not reproducible, policy fork, or needs a human), post a public GitHub PR comment before you stop. First line: `mergestorm-loop: dismiss`. Then one line per skipped finding (path, severity, why). That first line is the only dismiss marker Vortex reads.
|
|
51
51
|
6. Patch on the PR head branch only.
|
|
52
52
|
7. Push that head branch with an ordinary push. If the push is rejected because the remote branch moved, another patcher already pushed for this pass. Do not rebase, do not force, do not retry the push: stop and tell the human that a second patcher is active on this PR.
|
|
53
|
-
8. Call `review_wait_pr` again with `after_sha` set to the SHA you just pushed (7+ hex) and `timeout_s` 45. If the last envelope you acted on has that same `head_sha` (no new commit, for example a re-review requested on the same head), also pass `after_pass` set to that envelope's saved `pass`, so the wait cannot hand you that attempt again. For a freshly pushed SHA omit `after_pass`; its first pass is 1. Keep `after_sha` and `after_pass` unchanged across 45s timeout retries; never replace `after_pass` with the `pass` of an in-progress envelope. `
|
|
53
|
+
8. Call `review_wait_pr` again with `after_sha` set to the SHA you just pushed (7+ hex) and `timeout_s` 45. If the last envelope you acted on has that same `head_sha` (no new commit, for example a re-review requested on the same head), also pass `after_pass` set to that envelope's saved `pass`, so the wait cannot hand you that attempt again. For a freshly pushed SHA omit `after_pass`; its first pass is 1. Keep `after_sha` and `after_pass` unchanged across 45s timeout retries; never replace `after_pass` with the `pass` of an in-progress envelope. `pass` reads one exact attempt; `timeout_s` 0 reads once without waiting. An envelope whose `head_sha` is an older commit is a previous pass, not yours; keep waiting.
|
|
54
54
|
9. Repeat from step 4 until a stop rule fires.
|
|
55
55
|
|
|
56
56
|
## Stop rules
|
|
@@ -68,7 +68,7 @@ Map these to `mergestorm.pr_review/v1` envelope fields; do not invent statuses.
|
|
|
68
68
|
|
|
69
69
|
## Never
|
|
70
70
|
|
|
71
|
-
- submit a local review job, or call the job-id
|
|
71
|
+
- submit a local review job, or call the job-id tool `review_wait` here. Local jobs are `mergestorm-review`'s world: they cost credits and do not fire Vortex on the PR.
|
|
72
72
|
- land, merge, enqueue, or touch stack authoring beyond adopting the existing PR, or the merge queue
|
|
73
73
|
- change the account `auto_patch_enabled` from this skill, for any reason; Cyclone is muted per stack with `stack_adopt` or `stack_set`, never per account
|
|
74
74
|
- treat the key user's mute or `auto_patch_enabled` as covering a different Cyclone install user
|