Skip to content

Commit 5a7c240

Browse files
committed
refactor: enhance PR analysis workflow by implementing subtask creation for independent processing
1 parent f7395d9 commit 5a7c240

1 file changed

Lines changed: 116 additions & 106 deletions

File tree

.roo/rules-release-notes-writer/1_main_workflow.xml

Lines changed: 116 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -107,60 +107,58 @@ gh pr list --repo RooCodeInc/Roo-Code --state merged --base main --limit 1000 \
107107
</phase>
108108

109109
<phase name="pr_processing">
110-
<overview>
111-
Process each PR inline to gather details, categorize changes, and identify documentation needs.
112-
All analysis happens within this task without spawning subtasks.
113-
</overview>
114-
115-
<initialization>
116-
<action>Create tracking file for PR analysis</action>
117-
<file>.roo/tmp/release-notes/temp_pr_analysis_v[version].md</file>
110+
<initialization priority="CRITICAL">
111+
<action>Create .roo/tmp/release-notes/temp_pr_analysis_v[version].md</action>
118112
<details>
119-
Create the temp directory and file to track PR analysis results.
120-
Each PR analysis will be appended to this file as it completes.
113+
Parent task MUST create this file (and .roo/tmp/release-notes/temp_pr_inclusion_v[version].json, .roo/tmp/release-notes/temp_pr_list_v[VERSION].md if needed) before ANY subtasks.
114+
Subtasks will ONLY add entries to these temp files using the available safe file-editing capability (preserve existing content; no overwrites).
115+
Parent task MUST NOT add entries to temp_pr_analysis_v[version].md; this file is reserved exclusively for subtask outputs. The parent may only create/initialize the empty file(s).
116+
Temp files live under .roo/tmp/release-notes/
121117
</details>
122118
</initialization>
123119

124-
<inline_analysis_workflow>
120+
<subtask_pattern priority="CRITICAL">
125121
<for_each>PR in list</for_each>
126-
<action>Analyze PR inline using gh CLI</action>
127-
<steps>
128-
<step number="1">
129-
<action>Fetch PR details</action>
130-
<command>gh pr view [NUMBER] --repo RooCodeInc/Roo-Code --json number,title,author,mergedAt,labels,body,url</command>
131-
</step>
132-
<step number="2">
133-
<action>Extract linked issues from PR body</action>
134-
<details>Parse the PR body for issue references (Fixes #123, Closes #456, etc.)</details>
135-
</step>
136-
<step number="3">
137-
<action>Fetch linked issue details if present</action>
138-
<command>gh issue view [ISSUE_NUMBER] --repo RooCodeInc/Roo-Code --json number,title,author,body</command>
139-
</step>
140-
<step number="4">
141-
<action>Categorize the change</action>
142-
<categories>
143-
<category>Feature - New functionality</category>
144-
<category>QOL Improvement - UI/UX enhancement</category>
145-
<category>Bug Fix - Resolves an issue</category>
146-
<category>Provider Update - API provider changes</category>
147-
</categories>
148-
</step>
149-
<step number="5">
150-
<action>Identify documentation needs</action>
151-
<flags>
152-
<flag name="docs-new">Completely new feature requiring new documentation page</flag>
153-
<flag name="docs-update">Existing documentation needs updating</flag>
154-
<flag name="docs-example">New examples or use cases to add</flag>
155-
<flag name="docs-migration">Migration guide needed for breaking changes</flag>
156-
</flags>
157-
</step>
158-
<step number="6">
159-
<action>Append analysis to tracking file</action>
160-
<file>.roo/tmp/release-notes/temp_pr_analysis_v[version].md</file>
161-
</step>
162-
</steps>
163-
</inline_analysis_workflow>
122+
<action>Create investigation subtask using new_task tool</action>
123+
<implementation>
124+
<tool>new_task</tool>
125+
<mode>release-notes-writer</mode>
126+
<description>
127+
For each PR in the fetched or provided list, create a separate subtask
128+
using the new_task tool. Each subtask investigates one PR independently.
129+
</description>
130+
<iteration_approach>
131+
Process PRs sequentially or in batches, creating a new_task for each PR number.
132+
Wait for all subtasks to complete before proceeding to compilation phase.
133+
</iteration_approach>
134+
</implementation>
135+
<message_template>
136+
Investigate PR #[number] for release notes v[version].
137+
1. Get PR details: gh pr view [number] --repo RooCodeInc/Roo-Code --json number,title,author,mergedAt,labels,body,url
138+
2. Extract linked issues from PR body
139+
3. Get issue details if linked
140+
4. Categorize change (Feature/QOL/Bug Fix/Provider Update)
141+
5. Identify documentation needs (new features, behavior changes, deprecations)
142+
6. Add to .roo/tmp/release-notes/temp_pr_analysis_v[version].md at the start, preserving existing content (use the available safe file-editing capability)
143+
144+
Include documentation flags:
145+
- docs-new: Completely new feature
146+
- docs-update: Existing docs need updating
147+
- docs-example: New examples needed
148+
- docs-migration: Breaking changes
149+
150+
CRITICAL: Never overwrite existing content; only add entries while preserving prior content.
151+
MANDATORY: Insert the marker line '&lt;!-- generated-by-subtask: true --&gt;' immediately before the '---' separator in each PR entry.
152+
</message_template>
153+
<todos_template>
154+
[ ] Fetch PR #[number] details using gh pr view --repo RooCodeInc/Roo-Code
155+
[ ] Extract linked issues from PR body
156+
[ ] Get issue details for each linked issue
157+
[ ] Categorize the change (Feature/QOL/Bug Fix/Provider Update)
158+
[ ] Identify documentation needs
159+
[ ] Write analysis to .roo/tmp/release-notes/temp_pr_analysis_v[version].md
160+
</todos_template>
161+
</subtask_pattern>
164162

165163
<output_format>
166164
## PR #[number]: [Title]
@@ -172,15 +170,38 @@ gh pr list --repo RooCodeInc/Roo-Code --state merged --base main --limit 1000 \
172170
**Contributors**: [list]
173171
**Documentation Needs**: [none|docs-new|docs-update|docs-example|docs-migration]
174172
**Documentation Notes**: [If applicable, what needs documenting]
173+
&lt;!-- generated-by-subtask: true --&gt;
175174

176175
---
177176
</output_format>
178177

179-
<processing_guidance>
180-
<note>Process PRs sequentially, appending each analysis to the tracking file</note>
181-
<note>For large PR lists (10+), provide progress updates every 5 PRs</note>
182-
<note>If a PR fetch fails, note the error and continue with remaining PRs</note>
183-
</processing_guidance>
178+
<subtask_creation_example>
179+
<description>Example of creating subtasks for a PR list</description>
180+
<scenario>Given PRs: #1234, #1235, #1236 for version 3.20.1</scenario>
181+
<implementation><![CDATA[
182+
<!-- For each PR, create a subtask like this: -->
183+
<new_task>
184+
<mode>release-notes-writer</mode>
185+
<message>Investigate PR #1234 for release notes v3.20.1.
186+
187+
Get PR details: gh pr view 1234 --repo RooCodeInc/Roo-Code --json number,title,author,mergedAt,labels,body,url
188+
Extract linked issues and get details
189+
Categorize the change and identify documentation needs
190+
Add analysis to .roo/tmp/release-notes/temp_pr_analysis_v3.20.1.md at the start, preserving existing content</message>
191+
<todos>
192+
[ ] Fetch PR #1234 details
193+
[ ] Extract linked issues and get details
194+
[ ] Categorize and analyze
195+
[ ] Write to temp_pr_analysis_v3.20.1.md
196+
</todos>
197+
</new_task>
198+
]]></implementation>
199+
<critical_notes>
200+
- Parent creates temp files first
201+
- Each PR gets its own subtask
202+
- Subtasks only add entries; never overwrite existing content
203+
</critical_notes>
204+
</subtask_creation_example>
184205
</phase>
185206

186207
<phase name="changelog_alignment">
@@ -320,11 +341,11 @@ fi
320341
- Author signal: if bullet contains "thanks @user", "by @user", or "PR by @user" and that user equals the PR author or credited issue reporter, add +0.20 to score
321342
- Keyword boost: +0.05 when provider/model/domain keywords (e.g., OpenAI, Claude, Grok, Chutes, Qwen, LongCat, etc.) appear in both
322343
Confidence thresholds:
323-
- score >= 0.65 (after boosts) -> linked (confident). Treat as changelog-referenced.
324-
- 0.45 <= score < 0.65 OR multiple candidates within 0.05 -> ambiguous (needs review)
325-
- score < 0.45 -> unlinked
344+
- score &gt;= 0.65 (after boosts) -&gt; linked (confident). Treat as changelog-referenced.
345+
- 0.45 &lt;= score &lt; 0.65 OR multiple candidates within 0.05 -&gt; ambiguous (needs review)
346+
- score &lt; 0.45 -&gt; unlinked
326347
Tie-breakers: higher score; if within 0.02 then same author; then closer merge date to release date; then lowest PR number
327-
Edge case: If bullet credits exactly one username and exactly one PR in the window has that author, accept with score >= 0.50 (confidence="author-boost")
348+
Edge case: If bullet credits exactly one username and exactly one PR in the window has that author, accept with score &gt;= 0.50 (confidence="author-boost")
328349
Implementation notes:
329350
- Match only against PRs fetched for the version's date window
330351
- Persist mapping bullet_text -> { prNumber, confidenceScore, rationaleSignals[] } and use it to compute linked/ambiguous/unlinked counts
@@ -333,24 +354,33 @@ fi
333354
</step>
334355

335356
<step number="2a">
336-
<action>Supplement candidate PR set with changelog-referenced PRs not in fetched list</action>
357+
<action>Supplement candidate PR set with changelog-referenced PRs not in fetched list and spawn analysis subtasks</action>
337358
<details>
338359
- Identify referenced PR numbers from step 2 that are missing from .roo/tmp/release-notes/temp_pr_analysis_v[version].md
339-
- For each missing PR, fetch details and analyze inline (same process as pr_processing phase)
360+
- For each missing PR, fetch details and create a new investigation subtask (same pattern as pr_processing) to add analysis to temp_pr_analysis_v[version].md without overwriting existing content
340361
- Mark these as out_of_range if their mergedAt is outside the computed date window
341-
- Append analysis to the tracking file
362+
- Wait for all spawned subtasks to complete before proceeding
342363
</details>
343-
<inline_analysis>
344-
<for_each>Missing PR number referenced in changelog</for_each>
345-
<command>gh pr view [NUMBER] --repo RooCodeInc/Roo-Code --json number,title,author,mergedAt,labels,body,url</command>
346-
<process>
347-
- Fetch PR details
348-
- Extract linked issues
349-
- Categorize change
350-
- Identify documentation needs
351-
- Append to .roo/tmp/release-notes/temp_pr_analysis_v[version].md
352-
</process>
353-
</inline_analysis>
364+
<commands>
365+
<fetch><![CDATA[
366+
# For each referenced PR number N not present in .roo/tmp/release-notes/temp_pr_analysis_v[version].md:
367+
gh pr view N --repo RooCodeInc/Roo-Code --json number,title,author,mergedAt,labels,files
368+
]]></fetch>
369+
<spawn_subtask><![CDATA[
370+
<new_task>
371+
<mode>release-notes-writer</mode>
372+
<message>Investigate PR #[NUMBER] (changelog-referenced, possibly out of original range) for release notes v[version]. Follow standard analysis and add to .roo/tmp/release-notes/temp_pr_analysis_v[version].md without overwriting existing content.</message>
373+
<todos>
374+
[ ] Fetch PR #[NUMBER] details using gh pr view --repo RooCodeInc/Roo-Code
375+
[ ] Extract linked issues from PR body
376+
[ ] Get issue details for each linked issue
377+
[ ] Categorize the change (Feature/QOL/Bug Fix/Provider Update)
378+
[ ] Identify documentation needs
379+
[ ] Write analysis to .roo/tmp/release-notes/temp_pr_analysis_v[version].md
380+
</todos>
381+
</new_task>
382+
]]></spawn_subtask>
383+
</commands>
354384
</step>
355385

356386
<step number="2b">
@@ -429,6 +459,7 @@ fi
429459
</inputs>
430460
<precondition>
431461
- Inclusion policy required: If .roo/tmp/release-notes/temp_pr_inclusion_v[version].json does not exist, you MUST execute the changelog_alignment phase now to obtain an inclusion decision, then retry this step.
462+
- Subtask provenance required: All PR analysis entries MUST contain the marker '&lt;!-- generated-by-subtask: true --&gt;'. If any entries are missing this marker, HALT and re-run PR analysis via per-PR subtasks before proceeding.
432463
</precondition>
433464
<filtering>
434465
Include only PRs listed in "included" from .roo/tmp/release-notes/temp_pr_inclusion_v[version].json. Do not fall back to using all analyzed PRs without an explicit inclusion policy.
@@ -453,7 +484,7 @@ fi
453484
<checks>
454485
<check>Each bullet must answer: what changed, where the user sees it, why it matters.</check>
455486
<check>Replace internal terms (e.g., "protocol selector") with the on-screen wording users see.</check>
456-
<check>For fixes, start with "Fixes an issue where …" or "Resolves a problem where …" instead of echoing PR titles.</check>
487+
<check>For fixes, start with Fixes an issue where … or Resolves a problem where … instead of echoing PR titles.</check>
457488
</checks>
458489
</user_facing_rewrite>
459490
</step>
@@ -525,38 +556,10 @@ Which features should I highlight with expanded sections in the release notes?
525556
</step>
526557

527558
<step number="6">
528-
<action>Summarize documentation update needs</action>
529-
<when>If any documentation flags were identified during PR analysis</when>
530-
<output>
531-
Present a summary of documentation needs to the user:
532-
- List items flagged as docs-new (new features needing new pages)
533-
- List items flagged as docs-update (existing pages needing updates)
534-
- List items flagged as docs-example (new examples needed)
535-
- List items flagged as docs-migration (migration guides needed)
536-
537-
The user can then follow up with documentation-writer mode separately if desired.
538-
</output>
539-
<template><![CDATA[
540-
**Documentation Update Summary:**
541-
542-
The following items may need documentation updates:
543-
544-
**New Documentation Needed:**
545-
- [Feature name]: [Brief description of what needs documenting]
546-
547-
**Existing Docs Updates:**
548-
- [Page/feature]: [What needs updating]
549-
550-
**Examples Needed:**
551-
- [Feature]: [Example scenarios to add]
552-
553-
**Migration Guides:**
554-
- [Breaking change]: [Migration path to document]
555-
556-
To create these documentation updates, you can start a new task with documentation-writer mode.
557-
]]></template>
559+
<action>Create documentation update task</action>
560+
<when>If any documentation flags were identified</when>
561+
<tool>new_task with mode="documentation-writer"</tool>
558562
</step>
559-
560563
<step number="7">
561564
<action>Cleanup temporary files</action>
562565
<details>Delete .roo/tmp/release-notes/* (temp_pr_analysis_v[version].md, temp_pr_list_v[version].md, temp_pr_inclusion_v[version].json) after notes are finalized.</details>
@@ -697,13 +700,20 @@ gh pr list --repo RooCodeInc/Roo-Code --state merged --base main --limit 1000 \
697700
Date format is YYYY-MM-DD (ISO 8601) where MM is month (01-12)
698701
</rule>
699702
<rule priority="CRITICAL">
700-
All PR analysis happens inline within this task - do not spawn subtasks
703+
Parent task creates temp files, subtasks only add entries (never overwrite)
704+
</rule>
705+
<rule priority="CRITICAL">
706+
For each PR, the parent MUST create a subtask via new_task. The parent MUST NOT write PR analysis entries; only subtasks may add entries to .roo/tmp/release-notes/temp_pr_analysis_v[version].md without overwriting existing content. Do not proceed to changelog_alignment or compilation until all PR subtasks complete.
707+
Even when the parent already has the PR number, title, description, or a user‑provided
708+
summary list, it MUST still create and wait on the per‑PR subtask. These summaries are
709+
insufficient for functional understanding of the change, discovery of linked issues, and
710+
correct contributor attribution (PR authors and issue reporters).
701711
</rule>
702712
<rule priority="CRITICAL">
703713
Use the simplified PR extraction command for consistent results
704714
</rule>
705715
<rule priority="HIGH">
706-
Acknowledge PR author AND issue reporter, unless the username is on the release-notes "thank you" exclusion list.
716+
Acknowledge PR author AND issue reporter, unless the username is on the release-notes thank you exclusion list.
707717
If all candidate acknowledgements are excluded, omit the thanks parenthetical entirely.
708718
</rule>
709719
<rule priority="HIGH">

0 commit comments

Comments
 (0)