@@ -17,12 +17,16 @@ import {
1717 BOOTSTRAP_ISSUE_MARKER ,
1818 BOOTSTRAP_ISSUE_TITLE ,
1919 BOOTSTRAP_PR_TITLE ,
20+ BOOTSTRAP_RESEARCH_TITLE ,
2021 PAYLOAD_CHUNK_BYTES ,
2122 PAYLOAD_CHUNK_STRING_MAX_BYTES ,
2223 PAYLOAD_MAX_BYTES ,
2324 PAYLOAD_MAX_CHUNKS ,
2425 classifyBootstrapState ,
2526 createBootstrapPayloadEnvelope ,
27+ createBootstrapResearchComment ,
28+ findBootstrapResearchArtifacts ,
29+ isBootstrapResearchSeed ,
2630 reconstructBootstrapPayload ,
2731} from '../workflows/shared/squad-bootstrap-validator.mjs' ;
2832
@@ -198,6 +202,10 @@ Review the corresponding [draft Cast PR](${link}) before accepting the roster.
198202
199203## How to launch work
200204
205+ 1. Review and merge the linked draft Cast PR.
206+ 2. Rerun \`/squad triage\` to classify these existing proposals, or use focused \`/squad research ...\` first when deeper research is desired.
207+ 3. Run \`/squad plan\`, review the plan, then run \`/squad activate\` to create assignable implementation issues.
208+
201209\`\`\`text
202210/squad research Evaluate proposals P1 and P2 together, focusing on shared dependencies.
203211/squad research Evaluate proposals P1 through P3 as one program.
@@ -212,7 +220,7 @@ Use \`/squad implement\` only on generated implementation tasks, never on a prop
212220## Actionable backlog
213221
214222- [ ] Review and merge the draft Cast PR.
215- - [ ] Research and triage selected proposals.
223+ - [ ] Triage the existing proposals, or run focused research first when deeper evidence is desired .
216224- [ ] Review the plan and activate assignable implementation issues.
217225` ;
218226}
@@ -370,7 +378,24 @@ describe('automatic Squad bootstrap workflow', () => {
370378 expect ( classifyBootstrapState ( { pullRequests : [ ] , issues : [ ] , defaultBranch : 'main' } ) . action ) . toBe ( 'create_both' ) ;
371379 expect ( classifyBootstrapState ( { pullRequests : [ pull ( ) ] , issues : [ ] , defaultBranch : 'main' } ) . action ) . toBe ( 'create_issue' ) ;
372380 expect ( classifyBootstrapState ( { pullRequests : [ ] , issues : [ issue ( ) ] , defaultBranch : 'main' } ) . action ) . toBe ( 'create_pr' ) ;
373- expect ( classifyBootstrapState ( { pullRequests : [ pull ( ) ] , issues : [ issue ( ) ] , defaultBranch : 'main' } ) . action ) . toBe ( 'noop' ) ;
381+ expect ( classifyBootstrapState ( {
382+ pullRequests : [ pull ( ) ] ,
383+ issues : [ issue ( ) ] ,
384+ comments : [ ] ,
385+ defaultBranch : 'main' ,
386+ } ) . action ) . toBe ( 'create_research' ) ;
387+ const research = {
388+ id : 9 ,
389+ created_at : '2026-09-14T00:00:00Z' ,
390+ user : { login : 'github-actions[bot]' } ,
391+ body : createBootstrapResearchComment ( issueBody ( ) , 6 ) ,
392+ } ;
393+ expect ( classifyBootstrapState ( {
394+ pullRequests : [ pull ( ) ] ,
395+ issues : [ issue ( ) ] ,
396+ comments : [ research ] ,
397+ defaultBranch : 'main' ,
398+ } ) . action ) . toBe ( 'noop' ) ;
374399 expect ( classifyBootstrapState ( { pullRequests : [ pull ( 'closed' ) ] , issues : [ ] , defaultBranch : 'main' } ) . action ) . toBe ( 'opt_out' ) ;
375400 expect ( classifyBootstrapState ( { pullRequests : [ pull ( 'closed' , true ) ] , issues : [ ] , defaultBranch : 'main' } ) . action ) . toBe ( 'create_issue' ) ;
376401 } ) ;
@@ -393,6 +418,89 @@ describe('automatic Squad bootstrap workflow', () => {
393418 defaultBranch : 'main' ,
394419 } ) ,
395420 ) . toThrow ( / e x p e c t e d e x a c t t i t l e a n d d u r a b l e m a r k e r / ) ;
421+ expect ( ( ) =>
422+ classifyBootstrapState ( {
423+ pullRequests : [ ] ,
424+ issues : [ {
425+ number : 6 ,
426+ title : BOOTSTRAP_ISSUE_TITLE ,
427+ body : `${ BOOTSTRAP_ISSUE_MARKER } \n${ BOOTSTRAP_ISSUE_MARKER } ` ,
428+ } ] ,
429+ defaultBranch : 'main' ,
430+ } ) ,
431+ ) . toThrow ( / e x p e c t e d e x a c t t i t l e a n d d u r a b l e m a r k e r / ) ;
432+ } ) ;
433+
434+ it ( 'materializes one canonical research seed that normal triage can consume' , ( ) => {
435+ const comment = createBootstrapResearchComment ( issueBody ( ) , 6 ) ;
436+ expect ( comment ) . toContain ( BOOTSTRAP_RESEARCH_TITLE ) ;
437+ expect ( comment ) . toContain ( '| R1 | P1 is a validated bootstrap proposal' ) ;
438+ expect ( comment ) . toContain ( 'focused `/squad research ...`' ) ;
439+ expect ( comment ) . not . toContain ( '### P1 — Strengthen runtime contracts' ) ;
440+ expect ( comment ) . toContain (
441+ '{"squad_artifact":"research","schema_version":"1","origin_issue":6,"phases":[]}' ,
442+ ) ;
443+
444+ const artifacts = findBootstrapResearchArtifacts ( [
445+ {
446+ id : 9 ,
447+ created_at : '2026-09-14T00:00:00Z' ,
448+ user : { login : 'github-actions[bot]' } ,
449+ body : comment ,
450+ } ,
451+ ] , 6 ) ;
452+ expect ( artifacts ) . toHaveLength ( 1 ) ;
453+ expect ( isBootstrapResearchSeed ( artifacts [ 0 ] ) ) . toBe ( true ) ;
454+ expect ( isBootstrapResearchSeed ( {
455+ body : comment . replace ( BOOTSTRAP_RESEARCH_TITLE , '## 🔬 Squad Research — Focused follow-up' ) ,
456+ } ) ) . toBe ( false ) ;
457+ } ) ;
458+
459+ it ( 'fails closed on malformed research envelopes and repairs duplicate artifacts' , ( ) => {
460+ const valid = createBootstrapResearchComment ( issueBody ( ) , 6 ) ;
461+ expect ( ( ) => findBootstrapResearchArtifacts ( [
462+ {
463+ id : 10 ,
464+ created_at : '2026-09-14T00:00:00Z' ,
465+ user : { login : 'github-actions[bot]' } ,
466+ body : valid . replace ( '"origin_issue":6' , '"origin_issue":7' ) ,
467+ } ,
468+ ] , 6 ) ) . toThrow ( / c a n o n i c a l r e s e a r c h e n v e l o p e / ) ;
469+
470+ const duplicates = findBootstrapResearchArtifacts ( [
471+ {
472+ id : 10 ,
473+ created_at : '2026-09-14T00:00:00Z' ,
474+ user : { login : 'github-actions[bot]' } ,
475+ body : valid ,
476+ } ,
477+ {
478+ id : 11 ,
479+ created_at : '2026-09-14T01:00:00Z' ,
480+ user : { login : 'github-actions[bot]' } ,
481+ body : valid ,
482+ } ,
483+ ] , 6 ) ;
484+ expect ( duplicates . map ( ( { id } ) => id ) ) . toEqual ( [ 10 , 11 ] ) ;
485+ expect ( classifyBootstrapState ( {
486+ pullRequests : [ {
487+ number : 3 ,
488+ state : 'closed' ,
489+ merged : true ,
490+ title : BOOTSTRAP_PR_TITLE ,
491+ head : { ref : BOOTSTRAP_BRANCH } ,
492+ base : { ref : 'main' } ,
493+ html_url : 'https://github.com/octo/example/pull/3' ,
494+ } ] ,
495+ issues : [ {
496+ number : 6 ,
497+ state : 'open' ,
498+ title : BOOTSTRAP_ISSUE_TITLE ,
499+ body : issueBody ( 'https://github.com/octo/example/pull/3' ) ,
500+ } ] ,
501+ comments : duplicates ,
502+ defaultBranch : 'main' ,
503+ } ) . action ) . toBe ( 'create_research' ) ;
396504 } ) ;
397505
398506 it ( 'validates the shared Cast and issue payload with exact success output' , ( ) => {
@@ -543,7 +651,7 @@ describe('automatic Squad bootstrap workflow', () => {
543651 branch : 'attacker/override' ,
544652 issue_body : issueBody ( )
545653 . replace ( '| **Runtime** | Runtime Engineer |' , '| **Runtime** | Security Engineer |' )
546- . replace ( '/squad activate' , '/squad implement P1' ) ,
654+ . replaceAll ( '/squad activate' , '/squad implement P1' ) ,
547655 } ;
548656 writeFileSync ( fixture . payloadPath , `${ JSON . stringify ( mutated ) } \n` ) ;
549657 const result = validateFixture ( fixture ) ;
@@ -601,6 +709,12 @@ describe('automatic Squad bootstrap workflow', () => {
601709 expect ( WORKFLOW ) . toContain ( "state: 'all'" ) ;
602710 expect ( WORKFLOW ) . toContain ( 'github.paginate(github.rest.pulls.list' ) ;
603711 expect ( WORKFLOW ) . toContain ( 'github.paginate(github.rest.issues.listForRepo' ) ;
712+ expect ( WORKFLOW ) . toContain ( 'github.paginate(github.rest.issues.listComments' ) ;
713+ expect ( WORKFLOW ) . toContain ( 'createBootstrapResearchComment(' ) ;
714+ expect ( WORKFLOW ) . toContain ( 'findBootstrapResearchArtifacts(' ) ;
715+ expect ( WORKFLOW ) . toContain ( 'isBootstrapResearchSeed(currentResearch)' ) ;
716+ expect ( WORKFLOW ) . toContain ( 'Preserving focused research artifact comment' ) ;
717+ expect ( WORKFLOW ) . toContain ( 'github.rest.issues.deleteComment' ) ;
604718 expect ( WORKFLOW ) . toContain ( "draft: true" ) ;
605719 expect ( WORKFLOW ) . toContain ( "ref: `refs/heads/${stateModule.BOOTSTRAP_BRANCH}`" ) ;
606720 expect ( WORKFLOW ) . not . toContain ( 'auto-merge:' ) ;
0 commit comments