claude-code-session-manager 0.37.2 → 0.38.0
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/dist/assets/{TiptapBody-BtrSXTRp.js → TiptapBody-GMk5LS9Y.js} +1 -1
- package/dist/assets/{index-uVGdpAGF.js → index-CQqSHpIq.js} +250 -250
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/plugins/session-manager-dev/skills/develop/standards.md +1 -0
- package/plugins/session-manager-dev/skills/issue-address/0-select/0-fetch-pool/SKILL.md +38 -0
- package/plugins/session-manager-dev/skills/issue-address/0-select/1-reject-fixed/SKILL.md +64 -0
- package/plugins/session-manager-dev/skills/issue-address/0-select/2-reject-claimed/SKILL.md +71 -0
- package/plugins/session-manager-dev/skills/issue-address/0-select/3-rank-impact/SKILL.md +39 -0
- package/plugins/session-manager-dev/skills/issue-address/0-select/SKILL.md +75 -0
- package/plugins/session-manager-dev/skills/issue-address/1-confirm-open/SKILL.md +39 -0
- package/plugins/session-manager-dev/skills/issue-address/2-claim/SKILL.md +57 -0
- package/plugins/session-manager-dev/skills/issue-address/3-reproduce/SKILL.md +40 -0
- package/plugins/session-manager-dev/skills/issue-address/4-fix/SKILL.md +33 -0
- package/plugins/session-manager-dev/skills/issue-address/5-verify/SKILL.md +40 -0
- package/plugins/session-manager-dev/skills/issue-address/SKILL.md +120 -0
- package/plugins/session-manager-dev/skills/pr-review-sweep/0-fetch/SKILL.md +41 -0
- package/plugins/session-manager-dev/skills/pr-review-sweep/1-classify/SKILL.md +45 -0
- package/plugins/session-manager-dev/skills/pr-review-sweep/2-check-fixed/SKILL.md +49 -0
- package/plugins/session-manager-dev/skills/pr-review-sweep/3-queue/SKILL.md +50 -0
- package/plugins/session-manager-dev/skills/pr-review-sweep/4-land-and-resolve/SKILL.md +60 -0
- package/plugins/session-manager-dev/skills/pr-review-sweep/SKILL.md +124 -0
- package/plugins/session-manager-dev/skills/pr-signal/SKILL.md +67 -0
- package/src/main/__tests__/chat-cancel-terminal.test.cjs +31 -0
- package/src/main/__tests__/chat-exit-close-race.test.cjs +140 -0
- package/src/main/__tests__/scheduler-committed-in-window.test.cjs +64 -0
- package/src/main/chatRunner.cjs +37 -12
- package/src/main/ipcSchemas.cjs +2 -3
- package/src/main/scheduler.cjs +27 -4
- package/src/main/sessionsStore.cjs +4 -5
- package/src/main/webRemote.cjs +3 -3
- package/src/preload/api.d.ts +4 -5
- package/src/preload/index.cjs +3 -2
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: issue-address
|
|
3
|
+
description: Take ONE GitHub issue on the current project's repo from selection (or a named issue number) to a verified, reviewed fix — orchestrates 6 nested sub-skills (issue-address:select, :confirm-open, :claim, :reproduce, :fix, :verify) plus the existing requesting-code-review skill, so each step is independently invokable and monitorable. Use when the user wants a real issue picked and actually resolved, not just triaged.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# issue-address (orchestrator)
|
|
7
|
+
|
|
8
|
+
Global, project-agnostic issue-to-fix pipeline — works against whatever repo the current
|
|
9
|
+
project's `gh` remote points to. Fires exactly one issue through a fixed sequence of nested
|
|
10
|
+
skills — each a real, independently-invokable `SKILL.md`, not just a section header, so the
|
|
11
|
+
sequence's progress can be watched step by step instead of as one opaque pass. Codified from
|
|
12
|
+
`midt-bg/sigma`'s workflow; a project's own `AGENTS.md`/`CLAUDE.local.md` may add repo-specific
|
|
13
|
+
conventions (branch naming, claim-comment language, commit style) that this skill should read
|
|
14
|
+
and respect if present.
|
|
15
|
+
|
|
16
|
+
**Naming convention (see a project's own `AGENTS.md` if it documents one; otherwise this
|
|
17
|
+
convention still applies as the plugin's own standard):** sub-skill directories are prefixed
|
|
18
|
+
`0-`, `1-`, `2-`... in execution order, so a plain directory listing sorts in DAG order
|
|
19
|
+
without needing to open any file. Never rely on prose order alone — a reader (or an
|
|
20
|
+
alphabetically-sorted file browser) should see the sequence from the folder names
|
|
21
|
+
themselves. The invocable `name:` field stays a clean colon-scoped identifier
|
|
22
|
+
(`issue-address:select`) without the numeric prefix — the prefix is a filesystem/ordering
|
|
23
|
+
aid, not part of the skill's name.
|
|
24
|
+
|
|
25
|
+
## Pipeline DAG
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
┌─────────────────────┐
|
|
29
|
+
no issue # ──────▶ 0. issue-address:select │──▶ issue number
|
|
30
|
+
└─────────────────────┘ │
|
|
31
|
+
issue # given ─────────────────────────────────────┘
|
|
32
|
+
▼
|
|
33
|
+
┌───────────────────────────┐
|
|
34
|
+
│ 1. issue-address:confirm-open │
|
|
35
|
+
└───────────────────────────┘
|
|
36
|
+
GO │ │ NO-GO
|
|
37
|
+
▼ ▼
|
|
38
|
+
┌─────────────────────┐ STOP — report why
|
|
39
|
+
│ 2. issue-address:claim │
|
|
40
|
+
└─────────────────────┘
|
|
41
|
+
claimed │ │ claim failed to land
|
|
42
|
+
▼ ▼
|
|
43
|
+
┌─────────────────────┐ STOP — report (don't proceed
|
|
44
|
+
│ 3. issue-address:reproduce│ unclaimed)
|
|
45
|
+
└─────────────────────┘
|
|
46
|
+
reproduces │ │ doesn't reproduce
|
|
47
|
+
▼ ▼
|
|
48
|
+
┌─────────────────┐ STOP — report (valid outcome,
|
|
49
|
+
│ 4. issue-address:fix │ not a failure)
|
|
50
|
+
└─────────────────┘
|
|
51
|
+
│
|
|
52
|
+
▼
|
|
53
|
+
┌────────────────────┐
|
|
54
|
+
│ 5. issue-address:verify│──── red ────┐
|
|
55
|
+
└────────────────────┘ │
|
|
56
|
+
│ green │
|
|
57
|
+
▼ │
|
|
58
|
+
┌────────────────────┐ │
|
|
59
|
+
│ 6. requesting-code-review│ │
|
|
60
|
+
└────────────────────┘ │
|
|
61
|
+
│ │
|
|
62
|
+
▼ ▼
|
|
63
|
+
land per conventions loop back to step 4
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
| Step | Input | Output | On failure |
|
|
67
|
+
|---|---|---|---|
|
|
68
|
+
| 0. `issue-address:select` | open-issue pool (implicit — repo-wide) | one issue number + justification | n/a (always produces one, or explicitly reports the pool is empty) |
|
|
69
|
+
| 1. `issue-address:confirm-open` | one issue number | GO (+ title/body/repro steps) or NO-GO (+ reason) | **STOP** — do not proceed |
|
|
70
|
+
| 2. `issue-address:claim` | one confirmed-open issue number | self-assignment + claim comment, re-confirmed as landed | **STOP** — report if the claim didn't actually post; don't proceed unclaimed |
|
|
71
|
+
| 3. `issue-address:reproduce` | issue title/body/repro steps | failing test (file:line) + root-cause hypothesis + red-phase output | **STOP** — report "does not reproduce" (valid, not a failure) |
|
|
72
|
+
| 4. `issue-address:fix` | failing test + root-cause hypothesis | diff + the one test now green | loops internally until its one test is green |
|
|
73
|
+
| 5. `issue-address:verify` | diff + green reproduction test | full-suite pass counts + typecheck result | **loop back to step 4** — do not proceed to review on red |
|
|
74
|
+
| 6. `requesting-code-review` | the verified diff | Critical/Important findings addressed | fix findings, do not mark resolved until clean |
|
|
75
|
+
|
|
76
|
+
Called either with **no issue number** (enters at step 0) or with **one specific issue
|
|
77
|
+
number already named** (enters at step 1, skipping step 0 entirely).
|
|
78
|
+
|
|
79
|
+
**Why claim is its own step, not folded into confirm-open:** confirming an issue is
|
|
80
|
+
open/unclaimed and actually claiming it are two different moments in time — a gap where a
|
|
81
|
+
second concurrent run (or a human) could pick the same issue between the two. `select`'s
|
|
82
|
+
`reject-claimed` check only catches claims that already exist (an assignee, a "working on
|
|
83
|
+
this" comment); nothing marks the issue claimed *for this run* until `claim` actually
|
|
84
|
+
posts one. No dedicated GitHub/issue-tracking MCP server is connected in this environment
|
|
85
|
+
— `claim` uses the `gh` CLI directly (self-assign + comment), same as every other GitHub
|
|
86
|
+
interaction in this skill chain.
|
|
87
|
+
|
|
88
|
+
## After the sequence completes clean
|
|
89
|
+
|
|
90
|
+
- Commit with a conventional-commit message (`fix(scope): subject`, no trailing period, no
|
|
91
|
+
`Co-Authored-By` trailer unless the project's own convention says otherwise), on a branch
|
|
92
|
+
following the project's own `<type>/<slug>` convention if it documents one.
|
|
93
|
+
- **Only push / open a PR when explicitly asked** — per the project's own `AGENTS.md` PR
|
|
94
|
+
section if it has one, don't do it unprompted. Report the sequence as complete and ready,
|
|
95
|
+
and wait.
|
|
96
|
+
- If a PR does get opened (once asked), post a short comment on the originating issue
|
|
97
|
+
linking it — closes the loop from report to fix.
|
|
98
|
+
- Never contact a reviewer (no request/re-request/nudge) without the user's fresh,
|
|
99
|
+
explicit, per-instance approval — same hard constant as everywhere else in this workflow.
|
|
100
|
+
|
|
101
|
+
## Why nested skills instead of one inline sequence
|
|
102
|
+
|
|
103
|
+
Each step is its own file so it shows up as its own invocation in whatever surface tracks
|
|
104
|
+
skill/tool calls — you can see "select ran, chose #N over 4 rejected candidates" and
|
|
105
|
+
"confirm-open ran, returned GO" as distinct, inspectable events before "reproduce" even
|
|
106
|
+
starts, rather than one long undifferentiated pass. If a step needs to change (e.g. the
|
|
107
|
+
verify step's test-runner command, or select's ranking weights), it's a one-file edit that
|
|
108
|
+
doesn't touch the others. When a step needs more depth or clarity, decompose it further
|
|
109
|
+
the same way `issue-address:select` was (see `0-select/SKILL.md` for its own nested DAG)
|
|
110
|
+
— continuously, wherever a single file is doing too much to inspect as one unit.
|
|
111
|
+
|
|
112
|
+
## What this skill is not
|
|
113
|
+
|
|
114
|
+
- Not a pure triage/backlog tool — that's `find-opportunity` (ranks what to work on next
|
|
115
|
+
without opening/fixing anything, and never opens/fixes on its own). `issue-address:select`
|
|
116
|
+
overlaps with it in spirit (both rank by impact and check for claims) but exists
|
|
117
|
+
specifically to feed straight into actually fixing one issue in the same run, not just
|
|
118
|
+
to produce a shortlist for a human to review.
|
|
119
|
+
- Not for PR review comments — that's a different data source entirely (see
|
|
120
|
+
`pr-review-sweep` for the unresolved-review-thread workflow on already-open PRs).
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pr-review-sweep:fetch
|
|
3
|
+
description: Step 0 of pr-review-sweep — fetch every unresolved review thread on one or more of the current project's PRs, fully paginated. Never trust file names, a prior status report, or a reply's own claim about what's outstanding.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# pr-review-sweep:fetch
|
|
7
|
+
|
|
8
|
+
Query GitHub's GraphQL API directly for each PR. Resolve `$owner`/`$name` from the current
|
|
9
|
+
project's own remote — `gh repo view --json owner,name -q '.owner.login,.name'` — never
|
|
10
|
+
hardcode a repo.
|
|
11
|
+
|
|
12
|
+
```graphql
|
|
13
|
+
query($owner: String!, $name: String!, $n: Int!) {
|
|
14
|
+
repository(owner: $owner, name: $name) {
|
|
15
|
+
pullRequest(number: $n) {
|
|
16
|
+
reviewThreads(first: 100) {
|
|
17
|
+
totalCount
|
|
18
|
+
nodes {
|
|
19
|
+
isResolved
|
|
20
|
+
path
|
|
21
|
+
line
|
|
22
|
+
comments(first: 3) { nodes { author { login } body createdAt } }
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Filter to `isResolved: false`. **`first: 100` is load-bearing** — `first: 50` silently
|
|
31
|
+
truncates on any PR that has grown past 50 threads (two real PRs hit this: one had 64
|
|
32
|
+
threads, another had 55; the truncated queries under-reported unresolved counts and caused
|
|
33
|
+
genuinely-missed comments). Always compare `totalCount` to how many nodes you actually
|
|
34
|
+
paged through, and keep paginating (`after:` cursor) until they match — never report a
|
|
35
|
+
count you haven't verified is complete.
|
|
36
|
+
|
|
37
|
+
## Output
|
|
38
|
+
|
|
39
|
+
One unresolved-thread list per PR, each entry carrying: the PR number, thread id, file
|
|
40
|
+
path + line, and full comment text/author/timestamp — everything `pr-review-sweep:classify`
|
|
41
|
+
needs to decide disposition and type without a second round-trip to GitHub.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pr-review-sweep:classify
|
|
3
|
+
description: Step 1 of pr-review-sweep — classify each unresolved review thread on two independent axes — disposition (accept-as-is / policy-override / needs-my-decision) and type (bug / feature) — so downstream steps can route and template correctly.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# pr-review-sweep:classify
|
|
7
|
+
|
|
8
|
+
Decided per-thread, never per-PR — a single PR routinely mixes threads that need very
|
|
9
|
+
different handling.
|
|
10
|
+
|
|
11
|
+
## Axis 1 — disposition
|
|
12
|
+
|
|
13
|
+
- **Accept-as-is** — the reviewer's ask is valid, no repo-policy reason not to do it. The
|
|
14
|
+
default bucket.
|
|
15
|
+
- **Policy-override** — the comment conflicts with something the repo's own `AGENTS.md` /
|
|
16
|
+
`CLAUDE.local.md` already decided (a staged-rollout convention, an intentional
|
|
17
|
+
trade-off). Policy wins silently — no need to escalate to the user — but still reply
|
|
18
|
+
explaining why, so the reviewer isn't left wondering. Verify the policy text actually
|
|
19
|
+
says what you think it says before invoking this bucket; don't assume.
|
|
20
|
+
- **Needs-my-decision** — a genuine judgment call with no clear answer from repo policy
|
|
21
|
+
alone. Stop, surface the question verbatim to the user, never guess. This bucket blocks
|
|
22
|
+
only that one thread — every other thread on the PR keeps moving. A needs-my-decision
|
|
23
|
+
thread never gets a type tag (axis 2 is moot until it's decided to do the work at all).
|
|
24
|
+
|
|
25
|
+
## Axis 2 — type (accept-as-is and policy-override threads only)
|
|
26
|
+
|
|
27
|
+
- **Bug** — the reviewer flagged something objectively broken: wrong output, a crash, a
|
|
28
|
+
security issue, an off-by-one, a missed edge case. Anything where "what should happen
|
|
29
|
+
instead" is unambiguous from the current code being wrong.
|
|
30
|
+
- **Feature** — the reviewer asked for additional behavior, a refactor, or a
|
|
31
|
+
consistency/style improvement that isn't fixing broken behavior. If the current code does
|
|
32
|
+
what it currently does *on purpose* and the ask is to make it do something more or
|
|
33
|
+
different, it's a feature, not a bug — even when phrased urgently.
|
|
34
|
+
|
|
35
|
+
When genuinely ambiguous between the two (e.g. "this should also handle nulls" — is null
|
|
36
|
+
input a bug the code should already handle, or new scope?), default to **bug** only if
|
|
37
|
+
there's a concrete failing case (a real input that breaks today); otherwise **feature**.
|
|
38
|
+
Record the reasoning either way — `pr-review-sweep:queue` uses it to pick the PRD template,
|
|
39
|
+
and a future reader should be able to see why a borderline call went the way it did.
|
|
40
|
+
|
|
41
|
+
## Output
|
|
42
|
+
|
|
43
|
+
Per thread: `{disposition, type | null, reasoning}`. Needs-my-decision threads carry the
|
|
44
|
+
open question verbatim, collected for the final report rather than blocking the other
|
|
45
|
+
threads.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pr-review-sweep:check-fixed
|
|
3
|
+
description: Step 2 of pr-review-sweep — before queuing anything, triage every accept-as-is / policy-override thread into already-fixed, reply-only (no code change needed), or genuinely-open. Mandatory for every survivor, including policy-override threads — skipping it on the assumption "policy-override never needs a code check" is what caused a real wrong reply (see below).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# pr-review-sweep:check-fixed
|
|
7
|
+
|
|
8
|
+
Read the current file content at the cited location, and check recent git log/commits on
|
|
9
|
+
the PR's actual branch, for **every** accept-as-is/policy-override thread — no exceptions
|
|
10
|
+
for threads that look like a pure confirmation ask. **This step is mandatory before posting
|
|
11
|
+
any reply, not optional for policy-override threads.**
|
|
12
|
+
|
|
13
|
+
**Incident that made this mandatory:** on sigma PR #206, a policy-override thread (empty-
|
|
14
|
+
string EIK display) was replied to with "leaving as-is, test locks in current behavior"
|
|
15
|
+
without re-checking the code first — but the thread had *already been fixed* two commits
|
|
16
|
+
earlier by a different session. The wrong reply had to be corrected with a follow-up
|
|
17
|
+
comment. The cause wasn't a broken tool, it was skipping this step because the thread's
|
|
18
|
+
disposition (policy-override) felt like it obviously needed no verification. It didn't
|
|
19
|
+
obviously need verification — but it needed it anyway, and every thread does.
|
|
20
|
+
|
|
21
|
+
## Triage into three outcomes, not two
|
|
22
|
+
|
|
23
|
+
1. **Already-fixed** — the code (or a recent commit on the PR's branch) already does what
|
|
24
|
+
the thread asks. Routes straight to `pr-review-sweep:land-and-resolve`, citing the
|
|
25
|
+
fixing commit SHA. Skips `:queue` entirely.
|
|
26
|
+
2. **Reply-only, no code change needed** — the thread is fully answered by information
|
|
27
|
+
that already exists (a repo convention, an intentional design documented elsewhere, a
|
|
28
|
+
fact about the code the reviewer didn't have) and genuinely requires zero code change to
|
|
29
|
+
resolve — not "a trivial one-line fix," but literally nothing to write. Common for
|
|
30
|
+
policy-override threads whose reviewer ask was really a question ("confirm X is
|
|
31
|
+
intentional") rather than a change request. Routes straight to
|
|
32
|
+
`pr-review-sweep:land-and-resolve`, citing the evidence/reasoning instead of a SHA.
|
|
33
|
+
**Do not send these to `:queue`** — queuing a PRD to "fix" a thread that needs no fix
|
|
34
|
+
wastes a scheduler run and produces a PRD with no real acceptance criteria to execute.
|
|
35
|
+
3. **Genuinely open** — needs an actual code change that doesn't exist yet. Goes to
|
|
36
|
+
`pr-review-sweep:queue` as before, carrying its `{disposition, type}` tags.
|
|
37
|
+
|
|
38
|
+
The dividing line between outcomes 2 and 3: if you can point to the exact existing
|
|
39
|
+
line/paragraph that answers the reviewer's ask, it's outcome 2. If satisfying the ask
|
|
40
|
+
requires writing or changing any code, however small, it's outcome 3 — don't downgrade a
|
|
41
|
+
real fix to "reply-only" just because it's tiny; that's what `:queue`'s bug/feature
|
|
42
|
+
templates are for, sized appropriately.
|
|
43
|
+
|
|
44
|
+
## Output
|
|
45
|
+
|
|
46
|
+
Three lists per PR:
|
|
47
|
+
- **already-fixed** (thread id + the commit/line that fixed it) → `:land-and-resolve`
|
|
48
|
+
- **reply-only** (thread id + the evidence/reasoning to cite) → `:land-and-resolve`
|
|
49
|
+
- **survives** (thread id, disposition, type) → `:queue`
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pr-review-sweep:queue
|
|
3
|
+
description: Step 3 of pr-review-sweep — bundle surviving accept-as-is/policy-override threads by (PR, type) and queue one /develop PRD per bundle. Never fixes inline; the scheduler is the only place code changes happen.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# pr-review-sweep:queue
|
|
7
|
+
|
|
8
|
+
Only ever receives the **survives** list from `pr-review-sweep:check-fixed` — threads that
|
|
9
|
+
genuinely need a code change that doesn't exist yet. `check-fixed` has already routed
|
|
10
|
+
already-fixed and reply-only threads straight to `land-and-resolve`, so if you're looking
|
|
11
|
+
at a thread here, it needs real code written; don't second-guess that by trying to answer
|
|
12
|
+
it with a reply instead of a PRD.
|
|
13
|
+
|
|
14
|
+
Group `survives` threads by **(PR number, type)** — up to two bundles per PR, one `bug` and
|
|
15
|
+
one `feature`. Queue each bundle as its own `/develop` PRD. Never write the fix in this
|
|
16
|
+
session; this step's own actions are read-only except for the act of queuing.
|
|
17
|
+
|
|
18
|
+
## Duplicate-PRD guard (idempotency)
|
|
19
|
+
|
|
20
|
+
Before queuing a bundle, check the scheduler queue for an existing queued/in-flight PRD for
|
|
21
|
+
that same (PR, type). If one exists, skip queuing and report the existing PRD id instead —
|
|
22
|
+
re-running `pr-review-sweep` must never double-queue the same bundle. If a thread newly
|
|
23
|
+
qualifies for a bundle that already has an in-flight PRD (e.g. a fresh review comment
|
|
24
|
+
landed after the PRD was queued but before it completed), do not silently fold it in —
|
|
25
|
+
queue a follow-up PRD once the first completes, so each PRD's diff stays traceable to a
|
|
26
|
+
known snapshot of threads.
|
|
27
|
+
|
|
28
|
+
## PRD acceptance criteria, by type
|
|
29
|
+
|
|
30
|
+
Every PRD, regardless of type, ends with: commit + push to the fork branch that owns the
|
|
31
|
+
PR (never `origin`, never force-push, never a new PR to carry a review fix — land on the
|
|
32
|
+
existing PR's branch), and the standard two independent verification passes before commit.
|
|
33
|
+
|
|
34
|
+
- **`bug` bundle** — additionally require: reproduce each defect described in the bundled
|
|
35
|
+
threads, write a regression test per defect that fails before the fix and passes after,
|
|
36
|
+
then fix. The PRD body should quote the reviewer's exact wording per thread so the
|
|
37
|
+
executor root-causes the actual reported defect, not a guessed one.
|
|
38
|
+
- **`feature` bundle** — additionally require: scope the change to exactly what each
|
|
39
|
+
bundled thread asked for (no piggybacked scope creep across threads even though they're
|
|
40
|
+
bundled together), match existing patterns/conventions in the touched files, and add a
|
|
41
|
+
test only if the ask itself introduces new testable behavior.
|
|
42
|
+
|
|
43
|
+
Neither template authorizes a description edit or a reviewer request — those stay
|
|
44
|
+
`pr-review-sweep:land-and-resolve`'s and `pr-signal`'s jobs respectively, so a PR's
|
|
45
|
+
description reflects the *final* landed state, not a snapshot mid-fix.
|
|
46
|
+
|
|
47
|
+
## Output
|
|
48
|
+
|
|
49
|
+
Per (PR, type) bundle: a queued PRD id (new or pre-existing), or — if `survives` was empty
|
|
50
|
+
for that PR — nothing to queue, reported as such rather than silently skipped.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pr-review-sweep:land-and-resolve
|
|
3
|
+
description: Step 4 of pr-review-sweep — reply on the GitHub thread and resolve it, via one of three entry points from check-fixed/queue (already-fixed, reply-only, or a completed PRD). Runs async relative to steps 0-3 for the PRD path, typically triggered by a later project-status-local pass noticing a completed PRD.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# pr-review-sweep:land-and-resolve
|
|
7
|
+
|
|
8
|
+
Three entry points:
|
|
9
|
+
|
|
10
|
+
1. **Already-fixed threads** from `pr-review-sweep:check-fixed` — no PRD to wait on, act
|
|
11
|
+
immediately, citing the commit that step already identified.
|
|
12
|
+
2. **Reply-only threads** from `pr-review-sweep:check-fixed` — no PRD, no commit; act
|
|
13
|
+
immediately, citing the evidence/reasoning `check-fixed` already worked out (a repo
|
|
14
|
+
convention, an intentional-design confirmation, a fact about the code the reviewer
|
|
15
|
+
didn't have). **Re-verify that reasoning is still accurate right now, not just at
|
|
16
|
+
classify time** — code moves between when a thread was classified and when you're about
|
|
17
|
+
to reply; don't post a stale "confirmed" against code that's since changed.
|
|
18
|
+
3. **Queued PRDs** from `pr-review-sweep:queue` that the scheduler now reports
|
|
19
|
+
`completed` — this is where this step actually waits on external state; a fresh
|
|
20
|
+
`/project-status` (or manual) run is what notices the PRD finished and re-enters here.
|
|
21
|
+
|
|
22
|
+
## Steps
|
|
23
|
+
|
|
24
|
+
1. **For the PRD entry point only:** confirm the PRD actually ran its required
|
|
25
|
+
verification — both independent passes, and (for a `bug` bundle) that the regression
|
|
26
|
+
test genuinely exists and is green, not just claimed in the PRD's own summary. A PRD
|
|
27
|
+
marked `completed` without evidence of the ACs having run is `needs_review`, not landed —
|
|
28
|
+
report it as stuck, don't proceed to reply/resolve. (Already-fixed and reply-only
|
|
29
|
+
entries have no PRD to verify — skip to step 2.)
|
|
30
|
+
2. **Confirm CI is green** on the PR (for the PRD entry point, after the PRD's commit
|
|
31
|
+
landed; for already-fixed/reply-only, CI state is whatever it already is).
|
|
32
|
+
3. **Reply** on each thread — naming the specific fixing commit SHA for already-fixed/PRD
|
|
33
|
+
entries, or the evidence/reasoning for reply-only entries — so the reviewer can verify
|
|
34
|
+
without re-reading the whole diff or re-asking the question.
|
|
35
|
+
4. **Resolve** the thread via GraphQL `resolveReviewThread`. Order matters: reply first,
|
|
36
|
+
resolve second, so there's a paper trail explaining why a thread closed before it drops
|
|
37
|
+
off the unresolved list.
|
|
38
|
+
|
|
39
|
+
Needs-my-decision threads (set aside back in `pr-review-sweep:classify`), and any
|
|
40
|
+
policy-override thread where convention says the reviewer should be the one to close it,
|
|
41
|
+
are deliberately left unresolved after the reply — that is correct behavior, not an
|
|
42
|
+
oversight.
|
|
43
|
+
|
|
44
|
+
## Stuck PRDs
|
|
45
|
+
|
|
46
|
+
A `failed` or `needs_review` PRD is reported to the user as a stuck bundle, never silently
|
|
47
|
+
retried and never silently downgraded to an inline fix — re-queuing or fixing it directly
|
|
48
|
+
both require the user's decision, since either implies the original PRD's scope or ACs
|
|
49
|
+
were wrong.
|
|
50
|
+
|
|
51
|
+
## Hard constant
|
|
52
|
+
|
|
53
|
+
**Never contact a reviewer** at any point in this step — replying to a thread and
|
|
54
|
+
resolving it are not reviewer contact; requesting/re-requesting one is `pr-signal`'s job
|
|
55
|
+
alone, gated separately.
|
|
56
|
+
|
|
57
|
+
## Output
|
|
58
|
+
|
|
59
|
+
Per thread: resolved (+ the SHA it was resolved against), or reported as blocked (PRD
|
|
60
|
+
still in flight, or stuck) — loops back to `project-status-local`'s rollup either way.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pr-review-sweep
|
|
3
|
+
description: Sweep one or more of the current project's PRs' unresolved review comments end-to-end — fetch (paginated), classify by disposition AND bug-vs-feature type, check-if-already-fixed, queue a scheduler PRD per (PR, type), then land-and-resolve once it completes. Orchestrates 5 nested sub-skills (pr-review-sweep:fetch, :classify, :check-fixed, :queue, :land-and-resolve). Never fixes inline, never contacts reviewers. Use when a PR has open review feedback that needs triaging and landing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# pr-review-sweep (orchestrator)
|
|
7
|
+
|
|
8
|
+
Global, project-agnostic PR-review-clearing pipeline — works against whatever repo the
|
|
9
|
+
current project's `gh` remote points to. Run this per-PR whenever `/project-status` (or a
|
|
10
|
+
manual check) surfaces unresolved review threads. Codified from the process used to clear
|
|
11
|
+
review rounds on `midt-bg/sigma` PRs; a project's own `AGENTS.md`/`CLAUDE.local.md` may add
|
|
12
|
+
repo-specific policy notes (e.g. which threads are auto-accept vs. needs-decision, house
|
|
13
|
+
style for reply text) that this skill should read and respect if present.
|
|
14
|
+
|
|
15
|
+
**Naming convention (see a project's own `AGENTS.md` if it documents one; otherwise this
|
|
16
|
+
convention still applies as the plugin's own standard):** sub-skill directories are prefixed
|
|
17
|
+
`0-`, `1-`, ... in execution order, so a plain directory listing sorts in DAG order without
|
|
18
|
+
opening any file. The invocable `name:` field stays a clean colon-scoped identifier
|
|
19
|
+
(`pr-review-sweep:fetch`) without the numeric prefix.
|
|
20
|
+
|
|
21
|
+
**Always via the scheduler.** Every genuinely-unfixed thread is fixed by a `/develop` PRD,
|
|
22
|
+
never inline in this session — no "fast path" for small mechanical fixes. The scheduler is
|
|
23
|
+
the one place real code changes happen (global CLAUDE.md model-economics rule: interactive
|
|
24
|
+
sessions run an expensive planner-tier model; execution belongs on the cheap executor
|
|
25
|
+
tier). If a fast lane for small review fixes turns out to be worth having, that's a
|
|
26
|
+
scheduler-level feature (a priority/fast queue lane) to build later — not a reason for this
|
|
27
|
+
skill to bypass the scheduler now.
|
|
28
|
+
|
|
29
|
+
## Pipeline DAG
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
PR number(s)
|
|
33
|
+
│
|
|
34
|
+
▼
|
|
35
|
+
┌───────────────────────────┐
|
|
36
|
+
│ 0. pr-review-sweep:fetch │ paginated GraphQL, reviewThreads.isResolved ground truth
|
|
37
|
+
└───────────────────────────┘
|
|
38
|
+
│ every unresolved thread, full text + location
|
|
39
|
+
▼
|
|
40
|
+
┌───────────────────────────┐
|
|
41
|
+
│ 1. pr-review-sweep:classify │ disposition (accept/policy-override/needs-decision)
|
|
42
|
+
└───────────────────────────┘ × type (bug/feature) — two independent axes
|
|
43
|
+
│ per thread: {disposition, type}, needs-decision threads set aside
|
|
44
|
+
▼
|
|
45
|
+
┌───────────────────────────┐
|
|
46
|
+
│ 2. pr-review-sweep:check-fixed │ MANDATORY for every survivor — triage into 3 outcomes
|
|
47
|
+
└───────────────────────────┘ before queuing or replying to anything
|
|
48
|
+
│ │ │
|
|
49
|
+
│ already-fixed│ reply-only │ survives (genuinely needs new code)
|
|
50
|
+
▼ ▼ ▼
|
|
51
|
+
└──────┬───────┘ ┌───────────────────────────┐
|
|
52
|
+
│ │ 3. pr-review-sweep:queue │ one /develop PRD per
|
|
53
|
+
│ └───────────────────────────┘ (PR, type) bundle,
|
|
54
|
+
│ │ queued PRD id, or duplicate-guarded
|
|
55
|
+
│ │ "already queued"
|
|
56
|
+
│ ▼
|
|
57
|
+
│ ... async, on scheduler ...
|
|
58
|
+
│ │
|
|
59
|
+
▼ ▼
|
|
60
|
+
┌───────────────────────────────────┐
|
|
61
|
+
│ 4. pr-review-sweep:land-and-resolve │ cite SHA (already-fixed/PRD) or
|
|
62
|
+
└───────────────────────────────────┘ reasoning (reply-only); reply; resolve
|
|
63
|
+
│
|
|
64
|
+
▼
|
|
65
|
+
thread resolved, or reported stuck (failed/needs_review PRD)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
| Step | Input | Output | On failure/empty |
|
|
69
|
+
|---|---|---|---|
|
|
70
|
+
| 0. `pr-review-sweep:fetch` | one or more PR numbers | every unresolved review thread, verified-complete (paginated) | n/a — loops its own fetch until `totalCount` matches nodes paged |
|
|
71
|
+
| 1. `pr-review-sweep:classify` | unresolved threads | each thread tagged `{disposition, type}` | needs-decision threads are set aside, surfaced to the user, never guessed |
|
|
72
|
+
| 2. `pr-review-sweep:check-fixed` | accept/policy-override threads — **every one, no shortcuts** | `already-fixed` (w/ commit) + `reply-only` (w/ reasoning) + `survives` | never skip this because a thread's disposition "obviously" needs no code check — see the incident documented in that step's own file |
|
|
73
|
+
| 3. `pr-review-sweep:queue` | `survives` only, grouped by (PR, type) | one queued `/develop` PRD id per bundle | if a PRD for that (PR, type) is already queued/in-flight, skip and report its id — never double-queue |
|
|
74
|
+
| 4. `pr-review-sweep:land-and-resolve` | already-fixed / reply-only (immediate) or a PRD reported `completed` by the scheduler | thread replied (SHA or reasoning) + resolved | `failed`/`needs_review`/stuck PRDs are reported, never silently retried |
|
|
75
|
+
|
|
76
|
+
## Why two independent classification axes (step 1)
|
|
77
|
+
|
|
78
|
+
**Disposition** (accept-as-is / policy-override / needs-my-decision) answers "should this
|
|
79
|
+
be done at all, and does it need a human." **Type** (bug / feature) answers "what shape of
|
|
80
|
+
change is this, once we've decided to do it" — and drives which PRD template/acceptance
|
|
81
|
+
criteria `pr-review-sweep:queue` writes:
|
|
82
|
+
|
|
83
|
+
- **Bug** — the reviewer flagged something objectively broken (wrong output, crash,
|
|
84
|
+
security issue, off-by-one, missed edge case). The PRD's ACs require: a reproduction of
|
|
85
|
+
the defect, a regression test that fails before the fix and passes after, then the fix
|
|
86
|
+
itself.
|
|
87
|
+
- **Feature** — the reviewer asked for additional behavior, a refactor, or a
|
|
88
|
+
consistency/style improvement that isn't fixing broken behavior. The PRD's ACs require
|
|
89
|
+
scoping tightly to exactly what was asked (no piggybacked scope creep) and consistency
|
|
90
|
+
with existing patterns in the touched file; a regression test is only required if the ask
|
|
91
|
+
itself adds testable behavior.
|
|
92
|
+
|
|
93
|
+
Splitting by type — rather than one undifferentiated "fix it" PRD per PR — is what lets each
|
|
94
|
+
bundle get acceptance criteria actually suited to the kind of work it is, and is the reason
|
|
95
|
+
this classification exists as its own step rather than being folded into disposition.
|
|
96
|
+
|
|
97
|
+
## Hard constants across all five steps
|
|
98
|
+
|
|
99
|
+
- **Ground truth for "unresolved" is GraphQL `reviewThreads.isResolved`**, fully paginated
|
|
100
|
+
(`first: 100` — smaller page sizes have silently truncated on real PRs; always compare
|
|
101
|
+
`totalCount` to nodes actually paged through). Never a last-reply/last-push heuristic.
|
|
102
|
+
- **Never contact a reviewer** — no request, re-request, or nudge, at any point in this
|
|
103
|
+
process. Reviewer contact is `pr-signal`'s job alone, gated behind the user's explicit,
|
|
104
|
+
per-PR, freshly-given approval every time. A prior approval never carries forward.
|
|
105
|
+
- **Never fix inline.** Every genuinely-unfixed thread goes through `/develop`, no
|
|
106
|
+
exceptions — see the scheduler note above.
|
|
107
|
+
- **Idempotent re-runs.** One queued/in-flight PRD per (PR, type) bundle; replies aren't
|
|
108
|
+
re-posted; resolving an already-resolved thread is a no-op.
|
|
109
|
+
|
|
110
|
+
## Why nested skills instead of one inline sequence
|
|
111
|
+
|
|
112
|
+
Each step is its own file so it shows up as its own invocation in whatever surface tracks
|
|
113
|
+
skill/tool calls, and so a step can be changed (a new PRD template for a third `type`
|
|
114
|
+
bucket, a different fetch page size) without touching the others. `classify` is the step
|
|
115
|
+
most likely to grow — if a third type axis value earns its own PRD template later (e.g.
|
|
116
|
+
`docs`, `perf`), or `queue` needs different bundling logic per type, decompose that step
|
|
117
|
+
further the same way `issue-address:select` was, rather than growing this file.
|
|
118
|
+
|
|
119
|
+
## What this skill is not
|
|
120
|
+
|
|
121
|
+
- Not for GitHub issues — that's `issue-address` (a different data source: issues, not
|
|
122
|
+
open-PR review threads).
|
|
123
|
+
- Not a decision on whether to contact a reviewer — that's `pr-signal`, invoked separately
|
|
124
|
+
and rarely.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pr-signal
|
|
3
|
+
description: >-
|
|
4
|
+
Request or re-request a reviewer on one PR on the current project's repo — the ONLY
|
|
5
|
+
step in the PR flow that contacts a person. Deliberately separate from pr-review-sweep
|
|
6
|
+
and meant to be invoked rarely — most projects don't tag reviewers often. Requires the
|
|
7
|
+
user's explicit, fresh, per-PR approval every time — a prior approval never carries
|
|
8
|
+
forward, and CI must be green at the moment of signaling, not just when approval was
|
|
9
|
+
given. Use only when the user explicitly names a PR number and says to
|
|
10
|
+
request/ping/notify the reviewer, or approves signaling in response to a
|
|
11
|
+
pr-review-sweep report.
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# pr-signal — the one step that contacts a reviewer (rare, gated)
|
|
15
|
+
|
|
16
|
+
Global, project-agnostic — works against whatever repo the current project's `gh` remote
|
|
17
|
+
points to. Input: a PR whose queued PRDs have all landed and whose threads
|
|
18
|
+
`pr-review-sweep:land-and-resolve` has replied to and resolved (CI green) — plus the user's
|
|
19
|
+
explicit approval for this specific PR number, given in this conversation, not inherited
|
|
20
|
+
from an earlier one. If the project has its own reviewer-contact policy doc (e.g. sigma's
|
|
21
|
+
`docs/pr-review-workflow.local.md`), read it for repo-specific nuance — reviewer identity,
|
|
22
|
+
cadence norms — but the approval-per-PR and CI-green-at-signal-time gates below are hard
|
|
23
|
+
constants regardless of what a project's doc says.
|
|
24
|
+
|
|
25
|
+
**This skill runs far less often than the rest of the flow.** Most PRs on this repo don't need
|
|
26
|
+
an explicit re-request — a push alone re-triggers review for an already-requested reviewer, and
|
|
27
|
+
this team doesn't like being tagged unnecessarily. Only invoke this when the user actually asks
|
|
28
|
+
for it, by PR number.
|
|
29
|
+
|
|
30
|
+
## Steps
|
|
31
|
+
|
|
32
|
+
1. **Verify the gate, don't assume it from a report given earlier in the conversation:**
|
|
33
|
+
- The PR is still open (`gh pr view <n> --json state,mergedAt`) — a merged/closed PR gets
|
|
34
|
+
no signal; report the state change instead.
|
|
35
|
+
- Every review thread is resolved (re-check now via GraphQL `reviewThreads.isResolved` — a
|
|
36
|
+
`pr-review-sweep:land-and-resolve` report from even a few minutes ago can be stale if
|
|
37
|
+
anything else touched the PR, and a new comment that arrived since means the PR goes back
|
|
38
|
+
through `pr-review-sweep:classify`, not to a signal).
|
|
39
|
+
- CI is green **right now** — re-run `gh pr checks <n> --repo "$(gh repo view --json nameWithOwner -q .nameWithOwner)"` immediately
|
|
40
|
+
before acting. An approval given while CI was green does not survive CI going red in
|
|
41
|
+
between (a later push, a flaky rerun). If CI is red at signal-time, stop and report it —
|
|
42
|
+
never signal on a stale approval, and never solicit approval on a PR that's currently
|
|
43
|
+
CI-red in the first place.
|
|
44
|
+
- No review is already outstanding (requested, not yet dismissed by a later push) — if one
|
|
45
|
+
is, the push itself was already the signal; do not re-request
|
|
46
|
+
([[no-reviewer-ping-without-approval]] / [[reviewers-dont-spam]]).
|
|
47
|
+
- The user's approval is for **this PR number, in this conversation** — a blanket "yes,
|
|
48
|
+
signal when ready" said about a different PR, or said before this session, does not count.
|
|
49
|
+
|
|
50
|
+
2. **If any gate check fails**, stop and report exactly which one — don't ask "should I signal
|
|
51
|
+
now?" as a throwaway line and proceed anyway.
|
|
52
|
+
|
|
53
|
+
3. **If every gate check passes**, request the reviewer:
|
|
54
|
+
```bash
|
|
55
|
+
gh pr edit <number> --repo "$(gh repo view --json nameWithOwner -q .nameWithOwner)" --add-reviewer <reviewer>
|
|
56
|
+
```
|
|
57
|
+
If `gh pr edit` fails with the known "Projects (classic)" GraphQL deprecation error on this
|
|
58
|
+
repo, fall back to
|
|
59
|
+
`gh api repos/$(gh repo view --json nameWithOwner -q .nameWithOwner)/pulls/<n>/requested_reviewers -f "reviewers[]=<reviewer>"` —
|
|
60
|
+
and send it exactly once; verify via `gh pr view <n> --json reviewRequests` rather than
|
|
61
|
+
retrying blind (a retry after an ambiguous failure is how a double-ping happens).
|
|
62
|
+
Do not add a "ready for re-review" comment or @-mention on top of the request — the request
|
|
63
|
+
itself is the signal; a comment on top of it is the over-notification this skill exists to
|
|
64
|
+
avoid.
|
|
65
|
+
|
|
66
|
+
4. **Report** the PR as signaled, and loop back to `project-status-local` to pick up the new
|
|
67
|
+
state on its next run.
|
|
@@ -75,6 +75,37 @@ test('cancelling an ACTIVE run broadcasts a terminal event (unsticks the UI)', a
|
|
|
75
75
|
assert.match(terminal[0].payload.message, /cancel/i, 'message names the cancellation');
|
|
76
76
|
});
|
|
77
77
|
|
|
78
|
+
test('cancel() resolves only AFTER the terminal broadcast fires, not immediately on SIGTERM (PRD 718)', async () => {
|
|
79
|
+
// Order-of-events assertion (not timing-based — a real SIGTERM can be fast
|
|
80
|
+
// enough on a lightweight stub child that a fixed-delay race would flake).
|
|
81
|
+
const order = [];
|
|
82
|
+
cr.attachWindow({
|
|
83
|
+
isDestroyed: () => false,
|
|
84
|
+
webContents: {
|
|
85
|
+
isDestroyed: () => false,
|
|
86
|
+
send: (channel, payload) => {
|
|
87
|
+
if (isTerminal(channel) && payload.tabId === 'T2') order.push('terminal');
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
cr.run({ tabId: 'T2', sessionId: 'S2', prompt: 'hello', cwd: process.cwd(), resume: false });
|
|
93
|
+
|
|
94
|
+
for (let i = 0; i < 6; i++) await tick();
|
|
95
|
+
|
|
96
|
+
await cr.cancel('T2').then(() => order.push('resolved'));
|
|
97
|
+
|
|
98
|
+
assert.deepEqual(order, ['terminal', 'resolved'], 'cancel() resolves strictly after the terminal broadcast');
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test('cancel() on a tab with no in-flight or waiting run resolves immediately (no-op)', async () => {
|
|
102
|
+
cr.attachWindow({
|
|
103
|
+
isDestroyed: () => false,
|
|
104
|
+
webContents: { isDestroyed: () => false, send: () => {} },
|
|
105
|
+
});
|
|
106
|
+
await cr.cancel('no-such-tab'); // must resolve, not hang
|
|
107
|
+
});
|
|
108
|
+
|
|
78
109
|
function isTerminal(channel) {
|
|
79
110
|
return (
|
|
80
111
|
channel === 'chat:run:complete' ||
|