@a9n-shoji/rvw 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +24 -4
  3. package/dist/cli.mjs +188 -19
  4. package/dist/cli.mjs.map +4 -4
  5. package/dist/web/assets/DocumentViewer-B4LdSL1l.js +1560 -0
  6. package/dist/web/assets/{MarkdownTable-DbDc9VoP.js → MarkdownTable-CdbKPft2.js} +1 -1
  7. package/dist/web/assets/WalkthroughViewer-D1LlSQw2.js +1 -0
  8. package/dist/web/assets/{abnfDiagram-N423BO3Z-fQDP4qYL.js → abnfDiagram-N423BO3Z-CE1nZSC9.js} +1 -1
  9. package/dist/web/assets/architecture-TIHT7OUA-edLV2Zq-.js +1 -0
  10. package/dist/web/assets/{architectureDiagram-T3A2C74G-D3Aon3Nd.js → architectureDiagram-T3A2C74G-B88qYFUo.js} +1 -1
  11. package/dist/web/assets/{blockDiagram-VBNYF7ZC-DS1DcAqy.js → blockDiagram-VBNYF7ZC-BaX0rhbb.js} +1 -1
  12. package/dist/web/assets/{c4Diagram-5PPSVZJV-BHQWz7l2.js → c4Diagram-5PPSVZJV-C1ppBaEC.js} +1 -1
  13. package/dist/web/assets/channel-J8FHSJDG.js +1 -0
  14. package/dist/web/assets/{chunk-2GRJ4B5K-CaahxDVT.js → chunk-2GRJ4B5K-D2TTocfh.js} +1 -1
  15. package/dist/web/assets/{chunk-4I5QYGJK-Bat5hdXD.js → chunk-4I5QYGJK-ikT25rPN.js} +1 -1
  16. package/dist/web/assets/{chunk-5RXB4S5H-jyonN41f.js → chunk-5RXB4S5H-CGlPaulj.js} +1 -1
  17. package/dist/web/assets/{chunk-6Q2QTUOP-BBo9TYzL.js → chunk-6Q2QTUOP-BuuMeCo2.js} +1 -1
  18. package/dist/web/assets/{chunk-7Z6QIM7H-CGSwsKhC.js → chunk-7Z6QIM7H-DT3BAZ4L.js} +1 -1
  19. package/dist/web/assets/{chunk-GF5L2VYU-Cuca3bAY.js → chunk-GF5L2VYU-mIdlxzfr.js} +1 -1
  20. package/dist/web/assets/{chunk-I66GZJ75-DRdqLSyH.js → chunk-I66GZJ75-CGl1hx4J.js} +1 -1
  21. package/dist/web/assets/{chunk-JQJVKLGR-8xhLkhs2.js → chunk-JQJVKLGR-BLG6gAfx.js} +1 -1
  22. package/dist/web/assets/{chunk-KBJHAD2P-oOV-3e5-.js → chunk-KBJHAD2P-D_MPzBJx.js} +1 -1
  23. package/dist/web/assets/{chunk-NSK5VX7P-CXit1l3q.js → chunk-NSK5VX7P-CiYiU8wP.js} +1 -1
  24. package/dist/web/assets/{chunk-QR6OTTB3-DcdCU-01.js → chunk-QR6OTTB3-BK8Tnvcc.js} +1 -1
  25. package/dist/web/assets/{chunk-UBXNYLIW-i72Hgljr.js → chunk-UBXNYLIW-BuzttTFk.js} +1 -1
  26. package/dist/web/assets/{chunk-W5SLKNZC-DetAQo7M.js → chunk-W5SLKNZC-UidmFHe2.js} +1 -1
  27. package/dist/web/assets/{chunk-WRU74C26-DDUvJFNs.js → chunk-WRU74C26-nox7WFnh.js} +1 -1
  28. package/dist/web/assets/classDiagram-JCYQIIEL-CmTWSnH0.js +1 -0
  29. package/dist/web/assets/classDiagram-v2-OCEON4UE-CmTWSnH0.js +1 -0
  30. package/dist/web/assets/{cynefin-VYW2F7L2-fd-v6ani.js → cynefin-VYW2F7L2-wDMibS5s.js} +1 -1
  31. package/dist/web/assets/{cynefinDiagram-MW4NZA55-DRsVpAC3.js → cynefinDiagram-MW4NZA55-CBTrdvOE.js} +1 -1
  32. package/dist/web/assets/{dagre-VZM6K2ZE-BnRSs_fe.js → dagre-VZM6K2ZE-Bbgn4Rr7.js} +1 -1
  33. package/dist/web/assets/{diagram-7IWD3JNH-D1g0PR4y.js → diagram-7IWD3JNH-Bm9AuXb9.js} +1 -1
  34. package/dist/web/assets/{diagram-B4RE2ZJO-DuDKsQLp.js → diagram-B4RE2ZJO-D3lZ-r-H.js} +1 -1
  35. package/dist/web/assets/{diagram-LBJQPF4R-COpzgGe7.js → diagram-LBJQPF4R-D-GaynX7.js} +1 -1
  36. package/dist/web/assets/{diagram-Q27KOJAE-DR2vRbPE.js → diagram-Q27KOJAE-BeZRiu1d.js} +1 -1
  37. package/dist/web/assets/{diagram-UB23O5K3-hs4VGPP7.js → diagram-UB23O5K3-C3GP7iMe.js} +1 -1
  38. package/dist/web/assets/{ebnfDiagram-BXEA7PRR-B_4NlK9q.js → ebnfDiagram-BXEA7PRR-BJWg0NVU.js} +1 -1
  39. package/dist/web/assets/{erDiagram-JOGREHBK-JyoZ3U-o.js → erDiagram-JOGREHBK-XPmhUeB_.js} +1 -1
  40. package/dist/web/assets/eventmodeling-45OFAUF4-C3c4qddw.js +1 -0
  41. package/dist/web/assets/flowDiagram-UKHOOZJN-DMA-a1zf.js +1 -0
  42. package/dist/web/assets/{ganttDiagram-PKOTCBZU-f37I0Twm.js → ganttDiagram-PKOTCBZU-CL-xEo-M.js} +1 -1
  43. package/dist/web/assets/{gitGraph-TEB2WS4Q-B_QWjr7j.js → gitGraph-TEB2WS4Q-BVRyuIx3.js} +1 -1
  44. package/dist/web/assets/{gitGraphDiagram-DS77QQ5N-AZsaC0hu.js → gitGraphDiagram-DS77QQ5N-BVNIEupW.js} +1 -1
  45. package/dist/web/assets/index-D8GJBw23.js +384 -0
  46. package/dist/web/assets/{index-kK3hngnz.css → index-DMD2vvQW.css} +1 -1
  47. package/dist/web/assets/{info-DKCQHKI2-BRfisbEI.js → info-DKCQHKI2-BKBUVpfc.js} +1 -1
  48. package/dist/web/assets/{infoDiagram-6WML65LV-CaIb64N5.js → infoDiagram-6WML65LV-_dTFnzSE.js} +1 -1
  49. package/dist/web/assets/{ishikawaDiagram-WSZJBQD7-BoJrcTja.js → ishikawaDiagram-WSZJBQD7-DIRgD4hO.js} +1 -1
  50. package/dist/web/assets/{journeyDiagram-NVQOT4AX-CRR1dZy8.js → journeyDiagram-NVQOT4AX-bp7nZrfR.js} +1 -1
  51. package/dist/web/assets/{kanban-definition-27J2QSJJ-D5skDuP4.js → kanban-definition-27J2QSJJ-C6mZIo8S.js} +1 -1
  52. package/dist/web/assets/{line-BKKx0vSh.js → line-DWTym7eJ.js} +1 -1
  53. package/dist/web/assets/{mermaid-parser.core-DvZnIth0.js → mermaid-parser.core-CbecsNA1.js} +3 -3
  54. package/dist/web/assets/{mermaid.core-hykiOF_o.js → mermaid.core-CdRuLyYI.js} +4 -4
  55. package/dist/web/assets/{mindmap-definition-FAOFIHXS-BN2LQ4Yn.js → mindmap-definition-FAOFIHXS-CU2P1z-9.js} +1 -1
  56. package/dist/web/assets/{packet-7NZHBO7P-CS5I0NlV.js → packet-7NZHBO7P-CZsup6Od.js} +1 -1
  57. package/dist/web/assets/{pegDiagram-VL7TDLO6-WvOdhbxo.js → pegDiagram-VL7TDLO6-DTTyttpe.js} +1 -1
  58. package/dist/web/assets/{pie-RZYD4A2V-BwNAZrQ1.js → pie-RZYD4A2V-DgrIiWZA.js} +1 -1
  59. package/dist/web/assets/{pieDiagram-7S7Q4E2Y-CbyrZjm7.js → pieDiagram-7S7Q4E2Y-BBNFyPT1.js} +1 -1
  60. package/dist/web/assets/{quadrantDiagram-CIZ2JOQS-CW9YBxAO.js → quadrantDiagram-CIZ2JOQS-ejp-Aa2l.js} +1 -1
  61. package/dist/web/assets/{radar-I7S5WNFK-DBoCLDNH.js → radar-I7S5WNFK-Cp_hfjrI.js} +1 -1
  62. package/dist/web/assets/{railroad-3IZDKUUU-BOjpYyDz.js → railroad-3IZDKUUU-Dw-oMal2.js} +1 -1
  63. package/dist/web/assets/railroad-abnf-AHOZXSZD-BN-ZBhE0.js +1 -0
  64. package/dist/web/assets/railroad-ebnf-EBAXGLYW-CG97zyI2.js +1 -0
  65. package/dist/web/assets/railroad-peg-LSFZ7HO6-DHLQ1evQ.js +1 -0
  66. package/dist/web/assets/{railroadDiagram-AXF67PYL-BdOOOq8o.js → railroadDiagram-AXF67PYL-DkBUaj6Z.js} +1 -1
  67. package/dist/web/assets/{requirementDiagram-LRYGKXZP-DIYlSrTb.js → requirementDiagram-LRYGKXZP-Dff1ex_h.js} +1 -1
  68. package/dist/web/assets/{sankeyDiagram-W5VNT64P-Cc1IGxp_.js → sankeyDiagram-W5VNT64P-DptSL9Bc.js} +1 -1
  69. package/dist/web/assets/{sequenceDiagram-SI44F4Z6-CJsPO9Z9.js → sequenceDiagram-SI44F4Z6-DEnPcs3U.js} +1 -1
  70. package/dist/web/assets/{stateDiagram-OKZ733FA-B033gpHZ.js → stateDiagram-OKZ733FA-BwJO1MKA.js} +1 -1
  71. package/dist/web/assets/stateDiagram-v2-UEYNNEHI-LaSNqvWy.js +1 -0
  72. package/dist/web/assets/{swimlanes-SLNWSIFB-C0Tstg7e.js → swimlanes-SLNWSIFB-BosKiwZA.js} +1 -1
  73. package/dist/web/assets/swimlanesDiagram-ULZ7WXOC-C5OBtBlv.js +8 -0
  74. package/dist/web/assets/{timeline-definition-Z64GVDOM-BA3y-16W.js → timeline-definition-Z64GVDOM-C5isAn4X.js} +1 -1
  75. package/dist/web/assets/{treeView-QDETBFTQ-BUNq-JXr.js → treeView-QDETBFTQ-zEyUXRc4.js} +1 -1
  76. package/dist/web/assets/{treemap-6X3UGDF4-FIR_NbUo.js → treemap-6X3UGDF4-B-X0EQSE.js} +1 -1
  77. package/dist/web/assets/{vennDiagram-T6HMQDX7-IeFFjnlq.js → vennDiagram-T6HMQDX7-QMdGieCa.js} +1 -1
  78. package/dist/web/assets/{wardley-OPB4EBWU-DQAX4LKo.js → wardley-OPB4EBWU-BaeAF8d8.js} +1 -1
  79. package/dist/web/assets/{wardleyDiagram-T6FBY63Y-guGPPMAG.js → wardleyDiagram-T6FBY63Y-DTQ_uLUq.js} +1 -1
  80. package/dist/web/assets/{xychartDiagram-ELKLHX3M-Cj0v359_.js → xychartDiagram-ELKLHX3M-BMdBWzib.js} +1 -1
  81. package/dist/web/index.html +2 -2
  82. package/package.json +17 -14
  83. package/skills/rvw/SKILL.md +56 -15
  84. package/skills/rvw-watch-comments/SKILL.md +117 -47
  85. package/skills/rvw-watch-comments/agents/openai.yaml +2 -2
  86. package/skills/rvw-watch-comments/scripts/auto-ack.mjs +0 -0
  87. package/skills/rvw-watch-comments/scripts/preflight.mjs +0 -0
  88. package/skills/rvw-watch-comments/scripts/watch-driver.mjs +223 -48
  89. package/skills/rvw-watch-comments/scripts/watch-state.mjs +125 -64
  90. package/dist/web/assets/DocumentViewer-DvrDlIpR.js +0 -1560
  91. package/dist/web/assets/WalkthroughViewer-aDUeKC3B.js +0 -1
  92. package/dist/web/assets/architecture-TIHT7OUA-CuFS9GkN.js +0 -1
  93. package/dist/web/assets/channel-CTWz7tRI.js +0 -1
  94. package/dist/web/assets/classDiagram-JCYQIIEL-BJQv9QuO.js +0 -1
  95. package/dist/web/assets/classDiagram-v2-OCEON4UE-BJQv9QuO.js +0 -1
  96. package/dist/web/assets/eventmodeling-45OFAUF4-CfUhQK5g.js +0 -1
  97. package/dist/web/assets/flowDiagram-UKHOOZJN-FFZ82SPa.js +0 -1
  98. package/dist/web/assets/index-CY_JoUL3.js +0 -384
  99. package/dist/web/assets/railroad-abnf-AHOZXSZD-DQhDS2pf.js +0 -1
  100. package/dist/web/assets/railroad-ebnf-EBAXGLYW-Dtt2kOaN.js +0 -1
  101. package/dist/web/assets/railroad-peg-LSFZ7HO6-nfH8zno6.js +0 -1
  102. package/dist/web/assets/stateDiagram-v2-UEYNNEHI-wS01qj3t.js +0 -1
  103. package/dist/web/assets/swimlanesDiagram-ULZ7WXOC-DoAqfWAd.js +0 -8
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: rvw-watch-comments
3
- description: Continuously watch all Pull Requests saved in the local rvw database for new root comments and replies, durably queue them, acknowledge them immediately, investigate or delegate bounded batches, and replace the acknowledgement with a final rvw reply. Use when a user asks an Agent task to monitor, watch, poll, or continuously address new rvw review comments, optionally allowing fixes and pushes only for Pull Requests authored by the authenticated GitHub user.
3
+ description: Continuously watch all Pull Requests saved in the local rvw database for new root comments and replies, durably queue them, acknowledge them within reserved worker capacity, immediately delegate every acknowledged batch to a fresh subagent, and replace the acknowledgement with a final rvw reply. Use when a user asks an Agent task to monitor, watch, poll, or continuously address new rvw review comments, optionally allowing fixes and pushes only for Pull Requests authored by the authenticated GitHub user.
4
4
  ---
5
5
 
6
6
  # Watch rvw comments
@@ -68,22 +68,36 @@ direct-database transport; an unavailable selected transport is fatal.
68
68
  node '<SKILL_DIR>/scripts/preflight.mjs'
69
69
  ```
70
70
 
71
- Start the bundled driver with the state path. `--auto-ack` is the normal mode: it claims an eligible
72
- PR batch, re-reads every thread, creates or restores `🔎 確認中です…`, records suppression, and emits
73
- one `batch-acknowledged` JSON line containing the lease and operations. The first `watch-ready` line
74
- means monitoring is established. The driver chooses cursorless start only when state has no cursor;
75
- that intentionally skips all existing comments. Otherwise it resumes from the exact durable cursor.
76
- Before each initial connection or reconnect, it auto-acknowledges any eligible event that was durably
77
- ingested before an earlier driver interruption.
71
+ Before starting intake, reserve a positive number of subagent slots for this task. Use that exact
72
+ number as `<RESERVED_WORKER_SLOTS>`; use `1` when the runtime cannot guarantee more. Start the bundled
73
+ driver with the state path and the matching in-flight limit. `--auto-ack` is the normal mode: it claims
74
+ eligible PR batches only while fewer than that limit are in flight, re-reads every thread, creates
75
+ `🔎 確認中です…` (or restores it when retrying that batch), records suppression, and emits one
76
+ `batch-acknowledged` JSON line containing the lease and operations. The first `watch-ready` line
77
+ reports `maxInFlight` and means monitoring is established. The driver chooses cursorless start only
78
+ when state has no cursor; that intentionally skips all existing comments. Otherwise it resumes from
79
+ the exact durable cursor. Before each initial connection or reconnect, it auto-acknowledges eligible
80
+ durable work up to the same capacity. The driver atomically owns one lock beside the canonical state
81
+ path before spawning rvw. A second driver for the same state exits immediately; a later restart
82
+ removes a stale lock only when its recorded owner process no longer exists.
78
83
 
79
84
  ```bash
80
- node '<SKILL_DIR>/scripts/watch-driver.mjs' '<TASK_STATE_DB>' --auto-ack
85
+ node '<SKILL_DIR>/scripts/watch-driver.mjs' '<TASK_STATE_DB>' \
86
+ --auto-ack --max-in-flight '<RESERVED_WORKER_SLOTS>'
81
87
  ```
82
88
 
83
- The driver polls rvw once per second. After an unexpected EOF or process exit it re-reads the durable
84
- cursor and reconnects after 1, 2, 4, 8, then 16 seconds, capped at 30 seconds. Five short-lived
85
- reconnect failures are terminal; a run lasting at least 30 seconds resets that budget. Protocol error
86
- frames are terminal because retrying an invalid cursor or incompatible contract cannot recover.
89
+ Launch the driver through the runtime's long-lived streaming-process facility. Yield stdout to the
90
+ parent as soon as lines arrive; never wait for the driver to exit or buffer a group of lines before
91
+ dispatch. Process every `batch-acknowledged` line already received before waiting for more driver
92
+ output.
93
+
94
+ The driver polls rvw once per second and task state about every 250 milliseconds. Its state pump
95
+ automatically acknowledges work that becomes eligible after a lease release or `nextAttemptAt`; do
96
+ not wait for another comment event or reconnect and do not run a competing manual auto-ack loop. After
97
+ an unexpected EOF or process exit the driver re-reads the durable cursor and reconnects after 1, 2, 4,
98
+ 8, then 16 seconds, capped at 30 seconds. Five short-lived reconnect failures are terminal; a run
99
+ lasting at least 30 seconds resets that budget. Protocol error frames are terminal because retrying an
100
+ invalid cursor or incompatible contract cannot recover.
87
101
 
88
102
  Driver exit codes are stable:
89
103
 
@@ -94,6 +108,7 @@ Driver exit codes are stable:
94
108
  | `21` | Malformed, non-RFC-7464, or truncated watch output. |
95
109
  | `22` | Durable state status or ingest failure. |
96
110
  | `23` | Automatic acknowledgement failed; its claimed lease has already been returned to retry or quarantine when possible. |
111
+ | `24` | Another driver process already owns the same task state, or its owner lock cannot be acquired safely. |
97
112
 
98
113
  Without `--auto-ack`, the driver emits `pending` lines and leaves the batch unclaimed. An external
99
114
  monitor can also wait independently without hand-written polling:
@@ -110,7 +125,7 @@ a crash before that commit causes rvw to replay it. Never construct or edit curs
110
125
  ## Acknowledge and process a batch
111
126
 
112
127
  With the normal auto-ack driver, consume its `batch-acknowledged` object directly. Each operation has
113
- `commentRef`, the thread-stable `idempotencyKey`, `statusPostId`, `acknowledgement`, `status`, and the
128
+ `commentRef`, the batch-operation-stable `idempotencyKey`, `statusPostId`, `acknowledgement`, `status`, and the
114
129
  fresh `comment get` result as `thread`. A disappeared thread has `status: "gone"` and is not
115
130
  acknowledged. If intake runs without auto-ack, invoke the same complete fast path once for the PR:
116
131
 
@@ -121,9 +136,12 @@ node '<SKILL_DIR>/scripts/auto-ack.mjs' \
121
136
  ```
122
137
 
123
138
  For a null `statusPostId`, auto-ack sends exactly `{ "body": "🔎 確認中です…",
124
- "idempotencyKey": "<THREAD_KEY>" }` to `rvw comment reply`, then records the returned post. It omits
139
+ "idempotencyKey": "<BATCH_OPERATION_KEY>" }` to `rvw comment reply`, then records the returned post. It omits
125
140
  `authorLabel` and `relatedCommitOid`, so an uncertain retry has the identical payload. For an existing
126
- status post it sends `{ "body": "🔎 確認中です…", "relatedCommitOid": null }` to `comment edit`.
141
+ status post in the same retried batch it sends
142
+ `{ "body": "🔎 確認中です…", "relatedCommitOid": null }` to `comment edit`. A later batch for the
143
+ same thread has a new key and null `statusPostId`, so it creates another acknowledgement and never
144
+ rewrites the previous final answer.
127
145
  The acknowledgement's watch event is suppressed even when intake queued it before the post ID was
128
146
  recorded.
129
147
 
@@ -141,18 +159,37 @@ node '<SKILL_DIR>/scripts/watch-state.mjs' reserve-write \
141
159
  The unique reservation prevents two leases from writing the same repository. A manually invoked
142
160
  `auto-ack` may instead receive `--write-key` when that identity was already verified.
143
161
 
144
- ## Investigate directly or delegate
145
-
146
- For an `investigate-and-reply` batch containing only one or two comments with a focused source scope,
147
- the parent may investigate directly when doing so will not materially delay intake handling. Do not
148
- pay worker startup and result-relay cost for those small batches. Delegate broader investigation,
149
- multiple unrelated comments, or any authorized fix-and-push batch to one fresh worker per PR. The
150
- driver continues intake independently while the parent or worker investigates.
151
-
152
- Workers never access the task state or post rvw replies. Give a worker the raw comment URIs, policy,
153
- expected login, repository location, live head identity when relevant, lease ID, and one absolute
154
- result path outside the reviewed repository. Require an atomic write (temporary sibling followed by
155
- rename) of exactly this final JSON shape:
162
+ ## Delegate every acknowledged batch immediately
163
+
164
+ Treat delegation as a lease-safety invariant, not a size or complexity heuristic. On every
165
+ `batch-acknowledged` line, complete the handoff to exactly one fresh subagent for that lease in the
166
+ same parent scheduling turn and before any source inspection, mode classification, live-head check,
167
+ plan, progress update, or wait. Creating the absolute result path and assembling the handoff envelope
168
+ are the only parent actions allowed before dispatch. Do not accumulate leases for a later bulk
169
+ handoff.
170
+
171
+ No direct-processing exception exists. Delegate one-comment batches, apparently trivial requests,
172
+ `investigate-and-reply` work, no-code outcomes, and `fix-and-push` work alike. The parent must never
173
+ read surrounding source, edit code, run tests, commit, push, or synchronize on behalf of an
174
+ acknowledged batch. Keep the driver running and continue consuming intake while subagents work.
175
+
176
+ Consider dispatch complete only when the subagent runtime has accepted the task. Never leave an
177
+ acknowledged lease parked without a live subagent. If a fresh subagent cannot be started promptly,
178
+ call `fail` with a retryable dispatch error instead of processing the batch in the parent. Preserve
179
+ the reserved capacity for prompt dispatch and keep `--max-in-flight` at or below the number of slots
180
+ that can accept batches. The driver will restore the acknowledgement and emit a new lease when the
181
+ retry becomes due. Do not knowingly start or resume auto-ack intake without reserved capacity.
182
+
183
+ One subagent owns exactly one acknowledged lease. Do not add later events to its scope or reuse it for
184
+ another lease, including a later lease for the same PR. The parent alone owns the state database,
185
+ driver, result validation, final status-post edits, lease completion or failure, and follow-up drain.
186
+
187
+ Subagents never access the task state or post rvw replies. Give the subagent the unmodified
188
+ `batch-acknowledged` operations and raw comment URIs, policy, expected login, known repository
189
+ location, lease ID, and one absolute result path outside the reviewed repository. Do not delay the
190
+ handoff to discover live head identity; require the subagent to obtain and verify live values when
191
+ needed. Require an atomic write (temporary sibling followed by rename) of exactly this final JSON
192
+ shape:
156
193
 
157
194
  ```json
158
195
  {
@@ -161,26 +198,50 @@ rename) of exactly this final JSON shape:
161
198
  "outcomes": [
162
199
  {
163
200
  "commentRef": "rvw://comment/uuid",
164
- "body": "📝 調査結果\n\nConcise final outcome.",
165
- "commitOid": null,
166
- "pushStatus": "not-attempted"
201
+ "body": "📝 調査結果\n\nThe failure is handled by [the retry guard](rvw-ref:retry-guard).",
202
+ "relatedCommitOid": "0123456789abcdef0123456789abcdef01234567",
203
+ "references": [
204
+ {
205
+ "id": "retry-guard",
206
+ "label": "Retry guard",
207
+ "path": "src/request-handler.ts",
208
+ "startLine": 18,
209
+ "endLine": 24
210
+ }
211
+ ],
212
+ "pushStatus": "not-needed"
167
213
  }
168
214
  ]
169
215
  }
170
216
  ```
171
217
 
172
- `pushStatus` is `not-attempted`, `not-needed`, or `pushed`; `commitOid` is null unless a synchronized
173
- commit should be attached. The worker's completion notification only signals that the file is ready.
174
- The parent reads and validates the file after that notification and never depends on relayed message
175
- text for the result. Accept no progress, plans, or partial findings as the final result.
176
-
177
- Re-read each extant thread immediately before applying a direct or file result. Replace its recorded
218
+ `pushStatus` is `not-attempted`, `not-needed`, or `pushed`. `relatedCommitOid` is the exact available PR
219
+ commit containing every referenced path and may identify investigation evidence even when no change
220
+ was made. Set it to null only when `references` is empty. `references` is always the complete array for
221
+ that outcome. The subagent's completion notification only signals that the file is ready. The parent
222
+ reads and validates the file after that notification and never depends on relayed message text for the
223
+ result. Accept no progress, plans, or partial findings as the final result.
224
+
225
+ For every concrete claim about code behavior, an implemented change, or relevant test coverage, use
226
+ typed references by default so the reviewer can open the exact evidence. Select the smallest useful
227
+ committed range, include a signature plus the relevant body for multi-line behavior, link every
228
+ declaration from `body` as `rvw-ref:<referenceId>`, and keep IDs unique within the post. A repository
229
+ comment target already opens its exact source; do not duplicate it unless a separately labeled range
230
+ adds navigation value. Omit references only for outcomes without useful code evidence, uncommitted
231
+ evidence, terminal errors, or target-only evidence where another link would not help navigation.
232
+
233
+ Re-read each extant thread immediately before applying the file result. Replace its recorded
178
234
  status post with exactly one final outcome:
179
235
 
180
236
  - `✅ 対応しました` followed by the change, commit, and test result.
181
237
  - `📝 調査結果` followed by the conclusion when no code change was made.
182
238
  - `⚠️ 対応を継続できませんでした` followed by the terminal reason.
183
239
 
240
+ Validate the outcome's body, `relatedCommitOid`, and complete `references` array against the freshly
241
+ read thread, then pass all three fields to `rvw comment edit`. A result without references must send
242
+ `references: []`; set `relatedCommitOid` to null unless the post needs that commit for repository links
243
+ or images. Never leave references from the acknowledgement or a previous retry on the status post.
244
+
184
245
  Finish the lease only after every required final edit succeeds:
185
246
 
186
247
  ```bash
@@ -193,6 +254,12 @@ additional task-created posts. If a thread or its recorded status post disappear
193
254
  complete it without creating a replacement and report it as gone. Comment and reply bodies are UTF-8
194
255
  GFM Markdown up to 64 KiB, not 4 KiB; a 4093-byte result is within the contract.
195
256
 
257
+ An event for a PR with an active lease remains durable but is not eligible for another claim. After
258
+ `complete` releases the current lease, let the driver's state pump claim that PR's newly eligible
259
+ events and immediately delegate the emitted lease under the same rules. After retryable `fail`, let
260
+ the pump wait through the recorded `nextAttemptAt` and dispatch the restored lease when due. Never
261
+ assign a follow-up or retry to the previous subagent.
262
+
196
263
  ## Choose the worker mode
197
264
 
198
265
  Use `fix-and-push` only when all checks succeed immediately before reserving and making the first
@@ -211,7 +278,9 @@ branch name alone, local Git author, remote name, or rvw `authorLabel`.
211
278
  ### Investigate and reply
212
279
 
213
280
  Inspect exact and surrounding source read-only and produce one concise final outcome per affected
214
- comment. The parent edits the recorded status post; do not add another final reply.
281
+ comment. Use the exact commit that supports the conclusion as `relatedCommitOid` and follow the code
282
+ evidence defaults above even though no commit was pushed. The parent edits the recorded status post;
283
+ do not add another final reply.
215
284
 
216
285
  ### Fix and push an owned PR
217
286
 
@@ -223,9 +292,10 @@ retrying; never repeat the implementation blindly.
223
292
 
224
293
  After GitHub exposes the pushed head, run `rvw pr sync --repository '<WORKTREE>' --stdin --json`
225
294
  without comment updates. Then edit each status post with its final body and the synchronized head as
226
- `relatedCommitOid`. When a concise result benefits from direct evidence, include `rvw-ref:` links and
227
- the post's complete typed `references` array at that exact head. Otherwise omit references. If no code
228
- change is appropriate, edit the status post without a related commit or references.
295
+ `relatedCommitOid`. Follow the code evidence defaults above: link the implemented behavior and relevant
296
+ test ranges from the final body and include the post's complete typed `references` array at that exact
297
+ head. If the outcome has no useful code evidence, send `references: []` explicitly rather than
298
+ retaining stale declarations.
229
299
 
230
300
  ## Failure and stop
231
301
 
@@ -237,8 +307,8 @@ attempt, edit every extant status post to the terminal warning form, then call `
237
307
  retry, auto-ack restores the acknowledgement before work. Continue unrelated PRs.
238
308
 
239
309
  On graceful stop, stop dispatching, let active writes reach a safe boundary, terminate the driver,
240
- and report `status`. Resume with the stored cursor and `recover`; never start the same task twice with
241
- one state database.
310
+ and report `status`. The driver releases its owner lock after the rvw child exits. Resume with the
311
+ stored cursor and `recover`; never start the same task twice with one state database.
242
312
 
243
313
  ## Bundled CLI contract reference
244
314
 
@@ -251,7 +321,7 @@ stdout with a nonzero exit. Commands marked with stdin read one complete JSON ob
251
321
  | --------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
252
322
  | `init` | `--state PATH [--expected-login LOGIN] [--own-mode investigate-and-reply\|fix-and-push]` | none | `{ok,state,taskId,databaseId,cursor,expectedGitHubLogin,ownPullRequests,batches,inFlightBatches,quarantinedBatches}` |
253
323
  | `ingest` | `--state PATH` | `ready`, `comment-posted`, or `stopped` frame from rvw | `{ok,status,cursor[,sequence]}`; event and cursor commit atomically |
254
- | `list` | `--state PATH` | none | `{ok,pending:[{pullRequest,batchId,eventCount,firstSequence,commentRefs}]}` |
324
+ | `list` | `--state PATH` | none | `{ok,inFlight,pending:[{pullRequest,batchId,eventCount,firstSequence,commentRefs}]}` |
255
325
  | `wait` | `--state PATH [--interval-ms N] [--follow]` | none | `{ok,type:"pending",pullRequests,pending}` on empty-to-non-empty |
256
326
  | `claim` | `--state PATH --pull-request URL [--write-key owner/repo]` | none | `{ok,leaseId,batchId,pullRequest,attempts,writeKey,events,operations}` |
257
327
  | `reserve-write` | `--state PATH --lease ID --write-key owner/repo` | none | `{ok,leaseId,batchId,pullRequest,writeKey,status}` |
@@ -284,11 +354,11 @@ Frame schemas accepted by `ingest`:
284
354
 
285
355
  Claim `operations` are `{commentRef,idempotencyKey,statusPostId}`. Claim `events` are
286
356
  `{sequence,postId,commentRef,pullRequestUrl}`. State schema additions are created with
287
- `CREATE TABLE IF NOT EXISTS`; existing state databases remain readable and retain their cursors,
288
- leases, keys, and status posts.
357
+ idempotent local migrations; existing state databases remain readable and retain their cursors,
358
+ leases, and unfinished batch keys and status posts.
289
359
 
290
360
  | Script | Invocation | Output |
291
361
  | --------- | ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
292
362
  | Preflight | `node scripts/preflight.mjs` | One aggregate `{ok,node,rvw,agent,checks,errors}` object. |
293
- | Driver | `node scripts/watch-driver.mjs STATE [--auto-ack]` | `watch-ready`, `pending`, `batch-acknowledged`, and reconnect JSON lines. |
363
+ | Driver | `node scripts/watch-driver.mjs STATE [--auto-ack --max-in-flight N]` | `watch-ready`, `pending`, `batch-acknowledged`, and reconnect JSON lines. |
294
364
  | Auto-ack | `node scripts/auto-ack.mjs --state STATE --pull-request URL [--write-key owner/repo]` | Claimed lease plus `{events,operations}`; each operation includes the fresh thread or `gone`. |
@@ -1,4 +1,4 @@
1
1
  interface:
2
2
  display_name: "rvw Watch Comments"
3
- short_description: "Watch and address new rvw review comments"
4
- default_prompt: "Use $rvw-watch-comments to watch for and address new rvw review comments."
3
+ short_description: "Watch and delegate new rvw review comments"
4
+ default_prompt: "Use $rvw-watch-comments to watch and immediately delegate new rvw review comments."
File without changes
File without changes