@@ -244,6 +244,42 @@ describe("exec director allowlist", () => {
244244 expect ( names ) . not . toContain ( OUTSIDE_ALLOW ) ;
245245 } ) ;
246246
247+ test ( "the promoter does not commit list_dir onto the advertised wire" , ( ) => {
248+ const { activated, computeAdvertised, flushPromotions } =
249+ createAdvertisedToolset ( {
250+ sessionMode : "orchestrator" ,
251+ toolAvailability : { languageServerAvailable : true } ,
252+ getProvider : ( ) => ( { providerName : "test" , model : "test-model" } ) ,
253+ } ) ;
254+ let committed = 0 ;
255+ const promote = createExecToolPromoter ( {
256+ activate : ( names ) => activated . activate ( names ) ,
257+ isAllowed : ( ) => true ,
258+ commitWire : ( ) => {
259+ if ( flushPromotions ( ) ) committed += 1 ;
260+ } ,
261+ } ) ;
262+ const registry = [
263+ {
264+ name : "list_dir" ,
265+ description : "list a directory" ,
266+ inputSchema : { type : "object" , properties : { } } ,
267+ } ,
268+ {
269+ name : "mcp__acme__do" ,
270+ description : "do a thing" ,
271+ inputSchema : { type : "object" , properties : { } } ,
272+ } ,
273+ ] ;
274+ promote ( [ "list_dir" , "mcp__acme__do" ] ) ;
275+ expect ( activated . has ( "list_dir" ) ) . toBe ( false ) ;
276+ expect ( activated . has ( "mcp__acme__do" ) ) . toBe ( true ) ;
277+ expect ( committed ) . toBe ( 1 ) ;
278+ const names = computeAdvertised ( registry ) . map ( ( d ) => d . name ) ;
279+ expect ( names ) . not . toContain ( "list_dir" ) ;
280+ expect ( names ) . toContain ( "mcp__acme__do" ) ;
281+ } ) ;
282+
247283 test ( "skywalker overlay leaves every tool allowed" , ( ) => {
248284 const overlay = resolveExecDirectorOverlay ( "skywalker" ) ;
249285 expect ( isExecOverlayToolAllowed ( overlay , OUTSIDE_ALLOW ) ) . toBe ( true ) ;
@@ -652,6 +688,7 @@ describe("exec tool call gate and promoter", () => {
652688 "search and render layout primitives for pages" ,
653689 ) ,
654690 stringTool ( "plugin__notes__save" , "noted" , "Save granola notes" ) ,
691+ stringTool ( "list_dir" , "listed" , "list a directory's entries" ) ,
655692 stringTool ( submitOutputDefinition . name , "submitted" , "submit output" ) ,
656693 ] ) ;
657694 const { activated, isAdvertised, computeAdvertised, flushPromotions } =
@@ -760,4 +797,21 @@ describe("exec tool call gate and promoter", () => {
760797 expect ( result . content ) . toBe ( "submitted" ) ;
761798 expect ( result . isError ) . toBeUndefined ( ) ;
762799 } ) ;
800+
801+ test ( "executing list_dir does not add it to computeAdvertised" , async ( ) => {
802+ const { runner, computeAdvertised } = wireExecDiscovery ( ) ;
803+ const before = computeAdvertised ( runner . currentDefinitions ( ) ) . map (
804+ ( d ) => d . name ,
805+ ) ;
806+ expect ( before ) . not . toContain ( "list_dir" ) ;
807+ const result = await dispatch ( runner , "list_dir" ) ;
808+ expect ( result . content ) . toBe ( "listed" ) ;
809+ expect ( result . isError ) . toBeUndefined ( ) ;
810+ expect (
811+ computeAdvertised ( runner . currentDefinitions ( ) ) . map ( ( d ) => d . name ) ,
812+ ) . toEqual ( before ) ;
813+ expect (
814+ computeAdvertised ( runner . currentDefinitions ( ) ) . map ( ( d ) => d . name ) ,
815+ ) . not . toContain ( "list_dir" ) ;
816+ } ) ;
763817} ) ;
0 commit comments