@@ -617,7 +617,7 @@ describe("skill-workshop", () => {
617617 expect ( await store . list ( "pending" ) ) . toHaveLength ( 1 ) ;
618618 } ) ;
619619
620- it ( "keeps explicit tool suggestions pending when pending mode receives apply true " , async ( ) => {
620+ it ( "queues apply true suggestions in pending mode before explicit apply " , async ( ) => {
621621 const workspaceDir = await makeTempDir ( ) ;
622622 const stateDir = await makeTempDir ( ) ;
623623 let tool : AnyAgentTool | undefined ;
@@ -651,18 +651,24 @@ describe("skill-workshop", () => {
651651 const proposalId =
652652 ( result ?. details as { proposal ?: { id ?: string } } | undefined ) ?. proposal ?. id ?? "" ;
653653 expect ( proposalId ) . toBeTruthy ( ) ;
654- await expect (
655- tool ?. execute ?.( "call-2" , {
656- action : "apply" ,
657- id : proposalId ,
658- } ) ,
659- ) . rejects . toThrow ( "tool apply requires auto approval policy" ) ;
660654 await expect (
661655 fs . access ( path . join ( workspaceDir , "skills" , "screenshot-asset-workflow" , "SKILL.md" ) ) ,
662656 ) . rejects . toMatchObject ( { code : "ENOENT" } ) ;
663657 const store = new SkillWorkshopStore ( { stateDir, workspaceDir } ) ;
664658 expect ( await store . list ( "pending" ) ) . toHaveLength ( 1 ) ;
665659 expect ( await store . list ( "applied" ) ) . toHaveLength ( 0 ) ;
660+
661+ const applied = await tool ?. execute ?.( "call-2" , {
662+ action : "apply" ,
663+ id : proposalId ,
664+ } ) ;
665+
666+ expect ( applied ?. details ) . toMatchObject ( { status : "applied" } ) ;
667+ await expect (
668+ fs . access ( path . join ( workspaceDir , "skills" , "screenshot-asset-workflow" , "SKILL.md" ) ) ,
669+ ) . resolves . toBeUndefined ( ) ;
670+ expect ( await store . list ( "pending" ) ) . toHaveLength ( 0 ) ;
671+ expect ( await store . list ( "applied" ) ) . toHaveLength ( 1 ) ;
666672 } ) ;
667673
668674 it ( "uses the reviewer to propose existing skill repairs" , async ( ) => {
0 commit comments